I’ve struggled with a problem which seems pretty easy to solve, but I can’t seem to get it right.
On the page I’m writing the test for, the user meets a pop-up message.
I tried this code in order to close the pop-up:
TestObject luk = new TestObject(‘Object Repository/Smoketest/Page/div__cf-container__close’)
WebUI.openBrowser(null)
WebUI.navigateToUrl(‘site’)
WebUI.waitForElementVisible(luk, 8)
WebUI.click(luk)
But, I get the following error: 12-28-2019 07:40:44 AM Test Cases/Smoketest
Elapsed time: 59.677s
Test Cases/Smoketest FAILED. Reason: com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Smoketest/Page/div__cf-container__close’
[…] Caused by: org.openqa.selenium.WebDriverException: chrome not reachable
I defined the object by using the Inspct tool in Chrome > Copy > Xpath
TestObject luk = new TestObject(‘Object Repository/Smoketest/Page/div__cf-container__close’)
WebUI.waitForElementVisible(luk, 8)
WebUI.click(luk)
Now I get this error:
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Smoketest/Page/div__cf-container__close’ located by 'By.xpath: ’ not found
I tested the function in the console as you suggested - worked perfectly.
However, I’ve changed the selector to CSS in Katalon, and the popup still don’t close via Katalon.
So - the test execution is “Passed” but this i not reflrected in the UI