July 2019
Intermediate to advanced
536 pages
12h 57m
English
What happens if the test method calls a page object method that fails while a window or dialog box is open? Users will want to trap that exception using a try...catch...finally block, and close it so it does not block the next test run. Or, if using a reporter class, break out of the test method, take a screenshot, and then perform the cleanup in the @AfterMethod routine. Here is a quick example of both:
public class CreateUserTest { public class UserPO <M extends WebElement> { public UserPO() throws Exception { } @FindBy(id = "cancel") protected M cancel; public void createUser(JSONObject user) throws Exception { } public void verifyUser(String user) throws AssertionError { } public WebElement getCancel() { return ...
Read now
Unlock full access