I am doing a UI action and there are 2 possibilities;
1. I get an info message OR
2. I get a success message
Now I need to assert the same in Selenium.
Again there is only one outcome possible on the UI...either I get an info message OR i get a success message..
So basically I need to assert on either of the following;
assertThat(getAlertMessage("info", "cancel info message").getText(), equalTo("cancel info message"));
assertThat(getAlertMessage("success", "cancel success message").getText(), equalTo("cancel success message"));
Should I do a try catch OR use if...else ?