I want to handle exception ElementNotFound: in my code. But rather test should pass but it FAIL.
Click on HideShow button
Click ${HideShowBtn}
Sleep 1
TRY
${TitleComboBoxStatus} = Get Attribute ${TitledOption} IsEnabled
Log To Console Status of Titled ComboBoxes : ${TitleComboBoxStatus}
${UntitleComboBoxStatus} = Get Attribute ${UntitledOption} IsEnabled
Log To Console Status of Untitled ComboBoxes : ${UntitleComboBoxStatus}
IF ${TitleComboBoxStatus} and ${UntitleComboBoxStatus}
Fail Combo Boxes are not Hidden Successfully
ELSE
Log To Console Status of Comboboxes : Enabled
END
EXCEPT ElementNotFound:
Log To Console Combo Boxes are Hidden Successfully
END
I have a scenario when i want to click on “HideShow” button and there are elements “TitledOption” and “UntitledOption” are hidden. So i want to check if e.g. Element are not hidden then test should FAIL. and when these elements are hidden then test should Pass and message should display in Log .
Now when my code is run then test case is FAIL with error ElementNotFound: Element not found with locator 'id: …
How can i resolve the issue.? Please guide.
Thanks