tags:

views:

616

answers:

2

Hi i am new to qtp ,this is a sample script in which i am facing few errors like "URL might be wrong" could you kindly guide me through this.

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

Thanks in advance.

+2  A: 

I can see you've taken the example from Tarun's website. A couple of questions/pointers:

1) Is this all the code from your sample script?

2) Do you have the object repository that I expect comes with this example script?

3) Are all those random spaces present in your actual QTP code?

4) What exact error message are you getting? I think "URL might be wrong" is probably not what you're really getting...

Xiaofu
+1  A: 

1) Check whether u stored objects in object repository

2) 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()

3) Spaces should not present in the code example : ur script is Browser ("Google") .Page ("Google"). WebButton ("Google Search").Click

it should be Browser("Google").Page("Google").WebButton("Google Search").Click

Dilip