Reputation: 3992
I am new to qtp and this is a sample script in which I am facing a few errors like "URL might be wrong".
Browser ("Google").Navigate ( "http://www.google.com")
Browser ("Google"). Page ("Google").Sync
Browser ("Google"). Page("Google"). WebEdit("q:"). Set (" tarun lalwani")
Browser ("Google") .Page ("Google"). WebButton ("Google Search").Click
Browser ("Google") .Page (" tarun lalwani - Google").link ("knowledgeInbox").Click
Browser ("Google").Page ("knowledgeInbox").Sync
Browser ("Google") .close
What is going wrong?
Upvotes: 1
Views: 4998
Reputation: 11
SystemUtil.Run "iexplore","URL of the application"
With Browser("A").Page("B")
.WebEdit("Logical Name of the Text Field").Set"SearchKeyText"
.WebButton("Text label of the Button").Click
End With
Upvotes: 1
Reputation: 11
You should specify the browser:
browser("IE").Page("website name").etc.......
Or store it in a variable:
set a=browser("IE").page("name of ur site etc")
a.webedit("name of text field").set "pavan"
a.webbutton("search").click
You can also create a local repository before running the script.
Upvotes: 1
Reputation: 202
Check whether you stored objects in the object repository
Try the below mentioned code
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://www.google.co.in"
IE.Visible = True
IE.Document.All.Item("q").Value = "serach"
IE.Document.All.Item("f").submit()
There shoudl be no spaces in the code. For example your script is
Browser ("Google") .Page ("Google"). WebButton ("Google Search").Click
it should be
Browser("Google").Page("Google").WebButton("Google Search").Click
Upvotes: 1
Reputation: 15889
I can see you've taken the example from Tarun's website. A couple of questions/pointers:
Is this all the code from your sample script?
Do you have the object repository that I expect comes with this example script?
Are all those random spaces present in your actual QTP code?
What exact error message are you getting? I think "URL might be wrong" is probably not what you're really getting...
Upvotes: 2