When building the page object classes, there will frequently be components on a page that are common to multiple pages, but not all pages, and rather than including the similar locators and methods in each class, users can build a common class for just that portion of the page. HTML tables are a typical example of a common component that can be classed.
So, what users can do is create a generic class for the common table rows and columns, extend the subclasses that have a table with this new class, and pass in the dynamic ID or locator to the constructor when extending the subclass with that table class.
Let's take a look at how this is done:
- Create a new page object class for the table component in the application, but do not derive it from the base class in the framework
- In the constructor of the new class, add a parameter of the type WebElement, requiring...