We will start this refactoring by creating a new package under the java folder of the solution called pages, illustrated here:
- Right-click on the pages, select New > Java Class, and enter the name LandingPage
- Copy the preceding code snippet of LandingPage and paste it
- 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 ...