Hi,
I wanted to know if using Page Object Model can reduce reuse of Code.
For Example,
If we have a clickLogin operation for Login Page in LoginPage.class & clickSaveButton on Home Page inside HomePage.class, both are performing Click on a UI Element.
So will it not be useful to create a generic method click and pass the id as parameter ?
You can totally create the click method to reuse in your functions.
From my experience, in this case I’ll create a click method with two options:
1) click method with 2 parameters: element attribute (such as id, name, xpath etc), attribute value
2) click method with one parameter: attribute value. However, with this option, you need to handle your code to detect appropriate attribute
Goodluck