Calling page object methods in test classes

One of the most common mistakes users make when building automated tests is to build low-level event processing into their test class methods. We have been using the Selenium POM in this framework design, and what that means for the test classes is that you want to call the page object methods from within the test class methods, but not access the WebElements themselves. The goal is to reduce the amount of code being written and create a "library" of common methods that can be called in many places!

Now, what can be done in the framework to restrict users from going off track?

Users can set the scope of all WebElements defined in the page object classes to protected. That allows subclasses to access ...

Get Learn Selenium 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.