How to verify boolean condition in if statement

Boolean visible = WebUI.verifyElementVisible(findTestObject(‘BuyingAccessoy_Inputs/saveTheAddres’))

if (visible == true) {'BuyingAccessoy_Inputs/clickAddressBox'))'BuyingAccessoy_Inputs/selectTheAddress'))'BuyingAccessoy_Inputs/saveTheAddres'))




println (‘address already present’)


Note : BuyingAccessoy_Inputs/saveTheAddres element is not visible , but it is not executing the else statement…please help me … thanks in advance

if(visible) // visible is allready a boolean
verifyElementVisible throws an exception if it’s not handeled, it will stop any execution (even if will not be evaluated) so, to get aroud, use

WebUI.verifyElementVisible(findTestObject('BuyingAccessoy_Inputs/saveTheAddres'), FailureHandling.OPTIONAL)
1 Like