Inheriting WebElements
As previously noted, the details of using the inspectors have been outlined in other sources, but what will be covered here is the use of the Selenium Page Object Model to store common element definitions in base classes, which can then be inherited by all subclasses that are derived from them. This reduces the number of elements that need to be defined in the framework itself.
Let's look at a few examples.
If we right click over the Yahoo home page, we will see the Inspect Element menu choice. Once selected, an Inspector window will overlay the page, showing the DOM elements. Users can select the arrow button and move freely over the elements on the page until they find the ones they need to define.
So, let's say the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access