Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to do this .exist but it is always TRUE
#1
Not Solved
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
counter=1

While Not blnDone
        Wait (2)
        blnDone=Browser(oDeltaBrowser).Page(oDeltaPage).WebEdit("name:=departureCity\[0\]", "html id:=departureCity_0").Exist
        counter=counter+1
        If counter=10 then
            blnDone=True
        End if
Wend
Reply
#2
Not Solved
try using a function and pass the webedit properties as parameters.

Regards,
Ankesh
Reply
#3
Not Solved
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?
Reply
#4
Not Solved
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
     Wait(2)
Loop
Bascially it says is that if the browser is still on THIS SAME page, keep waiting for every 2 sec until the NEXT PAGE is loaded.

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?
Reply
#5
Not Solved
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
          Msgbox "obj not visible"
Else
         Msgbox "obj visible"
End If

And you might have to wait till the obj is loaded fully in some cases.
Code:
Browser().Page().WebEdit().WaitProperty "visible", True, 10000
10000 --> time in milli seconds
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]
Reply
#6
Not Solved
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

Done=False

While Not Done
        Wait (2)
        If Browser("name:=Delta - Book a flight").Page("title:=Delta - Book a flight").WebEdit("name:=departureCity\[0\]", "html id:=departureCity\[0\]").GetRoProperty("x") = 0 AND Browser("name:=Delta - Book a flight").Page("title:=Delta - Book a flight").WebEdit("name:=departureCity\[0\]", "html id:=departureCity\[0\]").GetRoProperty("y") = 0 Then
                  'Msgbox "obj not visible"
        Else
                 'Msgbox "obj visible"
                 Done=True
        End If
       counter=counter+1
       If counter=30 Then
           Done=True
       End If

Wend

'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)
   Wait(2)
Loop

'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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Smile If Then Is Always True For Web Objects zunebuggy 1 932 04-17-2020, 04:30 AM
Last Post: zunebuggy
  Exist and Visible Are True When Objects Aren't There - Is there A Better Way? zunebuggy 3 3,131 04-24-2018, 02:12 PM
Last Post: Ankur
  Time Delay issue with Exist mv8167 11 24,785 06-19-2017, 02:56 PM
Last Post: grosorg
  Performance Issues Using '.Exist' AndyBSG 2 3,480 12-12-2014, 03:24 PM
Last Post: AndyBSG
  datatable column exist diya 3 12,532 12-11-2012, 11:24 AM
Last Post: elango87

Forum Jump:


Users browsing this thread: 1 Guest(s)