Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Error: Object doesn't support
#1
Solved: 10 Years, 9 Months ago
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
Reply
#2
Solved: 10 Years, 9 Months ago
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"
Reply
#3
Solved: 10 Years, 9 Months ago
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!!!!
Reply
#4
Solved: 10 Years, 9 Months ago
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  File Chooser on Chrome doesn't work - UFT 15.0.1 Nenna Rosa 1 3,303 10-31-2020, 01:16 PM
Last Post: Ankur
  Intermitent "Object not visible" error erodpr 5 3,280 01-14-2016, 10:55 AM
Last Post: vinod123
  ERROR : Object reference not set to an instance of an object. Suyashxp 2 6,944 12-30-2014, 11:32 AM
Last Post: ursprasadp
  Object doesn't support this property or method: 'webedit' Divya Roopa 3 9,684 03-11-2014, 07:26 AM
Last Post: basanth27
  General run error. Line (18): "Loop while Browser("Index:=0").Object.Busy" AshokReddy 3 4,783 12-20-2013, 01:44 PM
Last Post: sshukla12

Forum Jump:


Users browsing this thread: 1 Guest(s)