Need a clever way to determine if an object is still visible on the screen
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.
try multiple attributes and value in xpath like - Class/type, value, id, name etc., which is unique identifier for your object.
Sample xpath for button - ("//input[@name='ok'][@type='button'][@id = 'sub1']")