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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.