Hi. I’m about to lose my nerve. Nothing seems to work the same on Mac/Safari as it does on Windows/whatever.
This works fine on all other systems/browsers:
if (WebUI.verifyElementVisible(findTestObject(‘Object Repository/1.0_ReleaseVersion/Cookie-Banner/CookieBanner’)))
{
WebUI.click(findTestObject(‘Object Repository/1.0_ReleaseVersion/Cookie-Banner/button_Got it’))
}
On Mac the test passes - but the button in fact is not clicked. The cookie banner is still present!
if (WebUI.verifyElementVisible(findTestObject(...))) {
WebUI.click(findTestObject(...))
}
Possibly better:
if (WebUI.verifyElementPresent(findTestObject('Object Repository/1.0_ReleaseVersion/Cookie-Banner/button_Got it'), 10)) {
WebUI.click(findTestObject('Object Repository/1.0_ReleaseVersion/Cookie-Banner/button_Got it'))
}
Rational
Your code WebUI.verifyElementVisible(... CookieBanner) possibly does not guarantee that the button_Got it element is ready to click. You should directly verify button_Got it is present before clicking it.
You should explicitly wait for the “button_Go it” itself to be present (=visible and clickable) before clicking it.
WebUI.verifyElementVisible() keyword will return immediately, it does not wait for the element being operational.
WebUI.verifyElementPresent() keyword does wait for specified seconds. Other “verifyXXX” and “waitForXXX” keywords with the 2nd argument “timeout” will be useful as well.
It did not work - same behaviour as before: TC turns green, cookie-button is saying to be clicked, but it’s still there… also adding an explicit ‘waitForElementClickable’ didnt do the job. The button is clickable
As far as I see, waitForElementClickable keyword is useless. WebUI.waitForElementClickable always return true immediately. Because all visible HTML element is clickable by definition.
WebUI.waitForElementClickable keyword does not interact with JavaScript on the page so it knows nothing about the event handlers set by JavaScript. It is useless.