Mac/Safari: Test passes, but buttons are not really clicked

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!

Is there no one who can comment on this?

Proposal

Not good.

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.

Thank you very much, I’ll give it a try and give you feedback

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

It is known that sometimes the Click keyword does not work; especially when the target web page is heavily JavaScript driven.

You may try Enhanced Click keyword instead of the Click keyword.

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.

1 Like

Thank you, a great option (Enhanced Click) - also does not work for me :expressionless:

no more idea. good luck.

Thank you very much for your time and ideas!!