Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem in working with IF END IF in QTP

Status
Not open for further replies.

Karthikeyan082075

Programmer
May 22, 2006
4
US
I have a scenario in my application where i click on a button to go to next page. Some time due to some error message, the application may come back to same page. In this case i need to provide proper info and again click on the button to move forward. I tried using IF...END IF for this and it does not seems to work.

Code snipet
-------------------------------------------------------
Dim obj_button
set obj_button = description.Create

obj_button("html tag").value = "button"
obj_button("name").value = "Find Flights"

Browser("b1").Page("p1").Link(obj_button).Click
wait(10)
If Browser("b1").Page("p1").Exist Then
Browser("b1").Page("p1").Link(obj_button).Click
Browser("b1").Sync ()

else

End If
--------------------------------------------------------
In the code snipet, i click on an object and wait for 10 seconds so that the next page comes up. In spite of the page currently displayed is not "p1" the control is going into the IF structure.

Can some one tell me what is the mistake that i am doing?
 
It could be that your application is opening the page, but setting focus to the "non p1" page.

Exists works to tell you that a window/[age is present, not necessarily that it can have focus set to it.

Just a thought...

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top