Unpredictable Cookie Banner

Perhaps you can create a Keyword that surrounds your click statement with a “try/catch” block that is looking for an ElementClickInterceptedException and then do some processing like you want. So, instead of just using,
WebUI.click(findTestObject('...'))
you use the Keyword, maybe like:
CustomKeyword.'com.Tools.performClick(findTestObject('...'))

@Keyword
public void performClick(TestObject tobj) {
    try {
        WebUI.click(tobj)
    catch (ElementClickInterceptedException) {
        "IF banner shows, click Accept "
        WebUI.click(findTestObject('myPage/Accept'))
        WebUI.waitForPageLoad(10)

        WebUI.waitForElementClickable(tobj, 10)
        WebUI.click(tobj)
    }
}
4 Likes