Selenium Beginner 10 – How To Use Config Properties File

Notes:

Today we will learn:

1. What is a properties file
2. How to create a properties file
3. How to get data from properties file
4. How to set data to properties file
5. Run test using Properties file

Helpful TIPS
_______________________________________________

How to get data from properties file

STEP 1: Create a object of class Properties class
Properties prop = new Properties();

STEP 2 : Create a object of class InputStream
InputStream input = new FileInputStream(“location of properties file”);

STEP 2 : Load Properties file
prop.load(input);

STEP 4 : Get values from Properties file
prop.getProperty(“browser”);


How to set data to properties file

STEP 1 : Create a object of class Properties class
Properties prop = new Properties();

STEP 2 : Create a object of class OutputStream
OutputStream output = new FileOutputStream(“location of properties file”);

STEP 3 : Set values
prop.setProperty(“result”, “pass”);

STEP 4 : Store values in properties file
prop.store(output, “comments”);

_______________________________________________
References – https://en.wikipedia.org/wiki/.properties


Selenium YouTube Playlist


Send me your comments and feedback

 

Comments 3

  • 540238 425283I enjoy your function , regards for all of the informative posts . 738438

  • I just want to say I am new to blogging and actually enjoyed your page. Very likely I’m want to bookmark your blog post . You definitely have amazing posts. Regards for revealing your webpage.

  • Okay here are the details. I want to add a new button to firefox, the purpose of that button is that when i type something in the address bar in firefox and click that button in navigation toolbar, that must serve the purpose of “I am feeling lucky button on google homepage”. Any super genius here?.

Leave a Reply

Your email address will not be published.

%d bloggers like this: