Refactor-2

We will start this refactoring by creating a new package under the java folder of the solution called pages, illustrated here:

  1. Right-click on the pages, select New > Java Class, and enter the name LandingPage
  2. Copy the preceding code snippet of LandingPage and paste it
  3. We also need to implement wait for the visibility of elements to remove any flakiness in the test

We learned about test synchronization in the last chapter, and we also learned about the importance of a proper wait strategy in the test. So, instead of having each page class create its own implementation of WebDriverWait, we can extract it to a base page, which can ...

Get Mobile Test Automation with Appium now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.