Micro Focus QTP (UFT) Forums
Getting Error: Object doesn't support - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Getting Error: Object doesn't support (/Thread-Getting-Error-Object-doesn-t-support)



Getting Error: Object doesn't support - mydestiny - 04-13-2009

Hi,
Well first of all i would like to thank to learnQTPSmile I am new to QTP and learning from this site only. Got enough materials and especially good tips from the forum.

I have written the following code:


Code:
Dim sOpenUrl
sOpenUrl = "http://newtours.demoaut.com/"
invokeURL(sOpenUrl)
Set objDescriptive = Description.Create()
objDescriptive("name").value = "user.*"
Set userNameObject = Browser("title:=Welcome:.*").Page("title:=Welcome: .*").ChildObjects(objDescriptive)
For i =0 to userNameObject.count -1

        userNameObject(i).Set "Demo"

Next


Function  invokeURL(sUrl )
   Dim objIE
   Dim objOpenIE
   Set objIE = CreateObject("InternetExplorer.Application")
   objIE.Visible = True
   objIE.Navigate sURL    
End Function

When i executed .. i am getting following error:
Object doesn't support this property or method: 'userNameObject(...).Set'
Line (10): "userNameObject(i).Set "Demo"".

Can any one guide me? Also please suggest whether i have implemented DP concept correctly or not ?

Cheers,
Prasad


RE: Getting Error: Object doesn't support - Tarik Sheth - 04-13-2009

Here is the corrected code:

Code:
Dim sOpenUrl

sOpenUrl = "http://newtours.demoaut.com/"
invokeURL(sOpenUrl)
Set objDescriptive = Description.Create()
objDescriptive("name").value = "userName"

' You missed to define webedit class for the object, now it works and username field is set with "Demo"
objDescriptive("micclass").value="WebEdit"
Set userNameObject = Browser("title:=Welcome:.*").Page("title:=Welcome: .*").ChildObjects(objDescriptive)

'Verify whether the object exist or not, put else condition if it does not.
Code:
If userNameObject.Count <>0 Then
    For i =0 to userNameObject.count -1
   userNameObject(i).Set str
Next
End If

I hope this clears your query.
Code:
Function invokeURL(sUrl )
Dim objIE
Dim objOpenIE
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate sURL
End Function[hr]


Add str="Demo"


RE: Getting Error: Object doesn't support - mydestiny - 04-14-2009

Thanks Tarik. But if i want to use the same concept for password field which micclass is also webEdit, then QTP won't identify which editfield it is going to put the value.
Any suggestion!!!!


RE: Getting Error: Object doesn't support - Tarik Sheth - 04-14-2009

Ok,

For every editbox class just define html tag as "INPPUT", in this case there are 2 edit box available on the web page so you need to include webedit class and html tag as "INPUT".
Following is what you need to write.

Code:
Dim sOpenUrl
str="Demo"
sOpenUrl = "http://newtours.demoaut.com/"
invokeURL(sOpenUrl)
Set objDescriptive = Description.Create()

'This code will input Demo in username and password fields.

Code:
objDescriptive("html tag").value="INPUT"
objDescriptive("micclass").value="WebEdit"



Set userNameObject = Browser("title:=Welcome:.*").Page("title:=Welcome: .*").ChildObjects(objDescriptive)

'Verify whether the object exist or not, put else condition if it does not.
Code:
If userNameObject.Count <>0 Then
For i =0 to userNameObject.count -1
userNameObject(i).Set str
Next
End If
'I hope this clears your query.
Code:
Function invokeURL(sUrl )
Dim objIE
Dim objOpenIE
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate sURL
End Function

Hope this will answer your query