How to make a Variable equal to a boolean value

Hey, Im trying to make a if statement based of a local variable
The local variable need to get a Boolean value from a verifyelementchecked statement

Any idea how I can get the Variable equal to the Boolean output of the verifyelementchecked, to put into a if statement

Eg if statement
if (Variable == False) { CheckElement……}

Using the example code from

// Open browser and navigate to demo AUT site
//Click on 'Make Appointment' button'Page_CuraAppointment/btn_BookAppointment'))
boolean result = WebUI.verifyElementChecked(findTestObject('Page_CuraAppointment/chk_Medicaid'), 10)
if (result) {    // or if (result == true)
    // do whatever you want
// Close Browser

Perfect, Just what I was looking for.

I am trying this method and I am having problems with it.
I am trying to get the result to equal false, because the element it is trying to verify isn’t present (I know it isn’t present) however, instead of failing and dropping down to the else if statement, it fails and stops the whole script.
What can I do about this?
Thanks in advance.


boolean result = WebUI.verifyElementChecked(

you should specify 3rd argument.

The default is FaiulreHandling.STOP_ON_FAILURE, this causes stopping the whole script as you saw.
One more alternative is FailureHandling.OPTIONAL.

1 Like

Thank you Kazuraym, that has worked brilliantly.