HTML/Java: .exists() always returns true

130 views Asked by At

I have the following code. The site has a tab that only shows up once something happens. I'm testing to see if the tab is showing up but it always returns true.

if (html_tab1().exists() == true) {
   //Some code
}

I think the problem is the way the html hides the tab. Does .exists() find the tab even when hidden from the HUD? If so, how do I rework the java to check for the tab as either hidden or showing. Thanks!

2

There are 2 answers

0
TJF On BEST ANSWER

My problem was fixed by using the following code

if(html_tab1().ensureObjectIsVisible()  == true) {
    //some code
}

Still interested to see why none of the others worked. I feel like .isShowing() should have done the job. Thanks for all the help!

0
Prakash On

Can you try

Object disp = html_tab1().getProperty(".currentStyle.display"); 
System.out.println("Display " + disp);

based on what you get as the value for the display property you can determine whether the control is visible. Other way could also be to try to get the screenRectangle() for the control and check in case the control is visible the bounds have zero width/height. etc