How can I click on a element while another element is not present


Could you please help me on this case?

I have many radio buttons on many pages, each page has a Continue button. I use a for loop to get xpath of them. Therefore, I have a need to click on Continue button if an element is not present. Could you please help by an example.



I am having same issue and can’t find the solution. Please tell me how you resolved that? I am waiting for your reply.


A try catch helps to solve the issue. Thanks for your help!


Thanks for your FB!

I tried this solution yesterday but it failed as when it looks for an element that is not on the current page but the next page, Katalon shows an error because it can’t find element to verify if it exists:

Unable to verify object ‘link’ is present (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘link’ located by ‘By.xpath: …’ not found)

My sample script:

for (int i = 1; i<=20;i++){
link = new TestObject(“link”)
link.addProperty(“xpath”, ConditionType.EQUALS,"//div[@class=‘a"+i+"’]", true)
if(WebUiBuiltInKeywords.verifyElementPresent(link, 10) == true){
WebUiBuiltInKeywords.scrollToElement(link, 3), FailureHandling.STOP_ON_FAILURE)
WebUiBuiltInKeywords.callTestCase(TestCaseFactory.findTestCase(‘Test Cases/GoNext’), [:],FailureHandling.STOP_ON_FAILURE)


Hi there,

In this case, you can insert a check to check for if an element is not present or not. After the check, you can do preceding action based on the check result.


if (WebUI.verifyElementNotPresent(findTestObject(‘Page_CuraAppointment/btn_BookAppointment’), 10) == true)