Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20073

Need a clever way to determine if an object is still visible on the screen

$
0
0

During my automation, I have a small popup that I have to select some radio buttons on and then an OK button that I need to click, but occasionally when I click it the click does not register, so I need to click again to close the popup.

 

I'm getting the object by:

 

  Set btn_Detail_Ok = page.FindChildByXPath("//a[@name='Ok']", True)

My first attempt was to just check if it Exists after we click it once:

  'Get the Ok button on the Level of Detail Options popup
  Set btn_Detail_Ok = page.FindChildByXPath("//a[@name='Ok']", True)
  btn_Detail_Ok.Click
  Log.Message("Clicked Ok button")
  aqUtils.Delay(2000)
  'If the Ok button still exists, click it again
  If btn_Detail_Ok.Exists Then
    btn_Detail_Ok.Click
    Log.Message("Clicked Ok button again")
  End If

But this does not work because the OK button exists all the time. To test this, I added this line of code before the small popup appears:

 

  Set btn_Detail_Ok_Dup = page.FindChildByXPath("//a[@name='Ok']", True)

And sure enough, I get the correct object.

 

I've looked at all of the properties of the object (visible, enabled, disabled, visibleOnScreen) and they're all the same. I'm looking for another way I can determine if we need to click the button again. Any ideas are appreciated.


Viewing all articles
Browse latest Browse all 20073