Here is the corrected code:
'Verify whether the object exist or not, put else condition if it does not.
I hope this clears your query.
Add str="Demo"
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"