Regarding Page Object Model


Please briefly explain why you feel this question should be reported .

Report Cancel


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 ?

in progress 0
Automation udit batra 1 Answer 1215 views 0

Answer ( 1 )

  1. Charlene
    September 27, 2016 at 9:07 pm

    Please briefly explain why you feel this answer should be reported .

    Report Cancel
    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


Leave an answer