mercredi 24 juin 2015

Best practices for implementing Page Object model for pages with many elements

I'm implementing Page Object model with Page Object factory and struggling to figure out the best way to handle pages with many elements. Page Object gets ugly when you have several checkboxes and want to create several methods for each of them. Let's say I have a page with checkbox1... checkboxN. For each of those elemements I want to have methods like isEnabled, isDisplayed, isChecked. If I implement it as it's suggested, I'll end up with 3xN methods like isCheckbox1Enabled, etc.

What is the best practice here? Should I provide simple get methods for those elements? Should I create map and single instance of each method like isCheckboxEnabled(String checkboxName)?

I don't like aproach with the map because then I have to know checkbox name inside my test...

Thanks!

Aucun commentaire:

Enregistrer un commentaire