Regarding Page Object Model

Report
Question

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

Report Cancel

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 ?

in progress 0
Automation udit batra 1 Answer 888 views 0

Answer ( 1 )

  1. Charlene
    0
    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

    Goodluck

Leave an answer

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>