Selenium Webdriver (Java): What are the benefits (if any) of using an objectmap.properties file instead of Page Objects classes? [closed]

StackOverflow https://stackoverflow.com/questions/20551198

Question

I'm implementing Selenium Webdriver 2 automated testing for our website, and am unable to find a clear assessment of what the benefits are of using an objectmap.properties file to store all the element locators, versus storing them in page objects java classes?

Also, it seems that using java classes for Page Objects allows exposing and abstracting page operations in those page objects classes too, whereas I'm not clear how this would be done if using an objectmap.properties file instead?

Or have I missed the point and the 2 are best used in conjunction?

Thanks in advance!

Was it helpful?

Solution

This is purely subjective. Some people prefer the simplicity of my_object=something then just fetching it using objectmap.get('my_object') while others, prefer using objects in Java. e.g. using LoginPage.TXT_USERNAME

Depending on your personal preference, and philosophies, you should determine which way is easier to you.

Personally, I think using java page objects are much more efficient because of the auto-complete that eclipse provides. I could do

LoginPage.TXT_USERNAME
LoginPage.TXT_PASSWORD

instead of having the possibilty of misspelling your object if you use a properties file like this:

objectmap.getProperty('TXT_USRNAME') # oops! forgot the E, and i wouldn't've known it until runtime.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top