Read data from Property File in Selenium Script using JAVA

In Selenium based JAVA project, .Properties files are used mainly to store configuration data like application URLs, database credentials etc. and web element locators..Properties file stores the data in a form of key & value pair as shown below:

If you see in above program, getPropertyFile() method is called to initialize the homePage.properties file and .properties file name is being passed as a parameter and this method will return the Properties class object.

Once initialization is done, then getProperty() method of Properties class is being called to get the value of any key stored in that Property file. It is that simple.

If you really like the information provided above, please don’t forget to hit a like on Facebook Page, you can also leave a comment.