Trying to do this .exist but it is always TRUE - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Trying to do this .exist but it is always TRUE (/Thread-Trying-to-do-this-exist-but-it-is-always-TRUE) |
Trying to do this .exist but it is always TRUE - chong67 - 07-05-2012 I have the following code below. It work as I dont want to use the Wait statement anymore. The problem is that I have to cut and paste these code into everyone of my Test Flow step because the .WedEdit variable will change on each of the flow. Is there a way to cut down on the repetitive step? =============== Code: blnDone=Browser(oDeltaBrowser).Page(oDeltaPage).WebEdit("name:=departureCity\[0\]", "html id:=departureCity_0").Exist RE: How to make '.exist' condition as global? - Ankesh - 07-05-2012 try using a function and pass the webedit properties as parameters. Regards, Ankesh RE: How to make '.exist' condition as global? - chong67 - 07-06-2012 Ankesh, You mean using f(x) ? I get it. I got another problem. I have done msgbox(blnDone) to see do my debugging. On some of the pages, the page have not loaded and my my blnDone is TRUE and hence .exist is true and code did not wait at all! I am very confused! I am trying to avoid using Wait statement. Do you have any idea? RE: Trying to do this .exist but it is always TRUE - chong67 - 07-07-2012 I have the following snippit of code here. Code: Do While Browser(oDeltaBrowser).Page(oDeltaPage).WebElement("html id:=intro_text", "outertext:=AWAY WE GO. ARRIVING AT YOUR FLIGHTS SOON ").Exist NOW the NEXT page is loaded and it doesnt have this property anymore, YET it is still STUCK IN THIS LOOP. I just dont undestand. How should I debug this? Any ideas? RE: Trying to do this .exist but it is always TRUE - vIns - 07-07-2012 Hi, .Exist method will return True even if the object is hidden. ie, object is still there but it is not visible. So, just check if the object is visible or not. Code: If Browser().Page().WebEdit().GetRoProperty("x") = 0 AND Browser().Page().WebEdit().GetRoProperty("y") = 0 Then And you might have to wait till the obj is loaded fully in some cases. Code: Browser().Page().WebEdit().WaitProperty "visible", True, 10000 It is same like Wait method but if the obj is visible in 3 seconds, it will exit from the statement. It will not wait for 10 seconds which is good[/php] RE: Trying to do this .exist but it is always TRUE - chong67 - 07-09-2012 VIns, Thank you for giving me this hint about the object is visible or not! I turn it around and troubleshoot and I use what you post to my advantage and guess what, it works! But I am very very confused! 'This code works! Code: Dim Done, counter 'This code did not work for me AND I WANT TO USE THIS ONE! Please help Code: Do While Browser("name:=Delta - Book a flight").Page("title:=Delta - Book a flight").WebEdit("name:=departureCity\[0\]", "html id:=departureCity\[0\]").Exist(0) 'This code did not work for me Code: Browser("name:=Delta - Book a flight").Page("title:=Delta - Book a flight").WebEdit("name:=departureCity\[0\]", "html id:=departureCity\[0\]").WaitProperty "visible", True, 59000 I want to use the middle code. (See my comment) I cant figure out why. Any ideas? |