Why we used property file in Selenium?
Whats the need of Property File/Repository??
Parameterization of a particular test is needed in order to avoid hard coding of values. The following Example actually demonstrates the usage of parameterization.
Let us assume that our test suite contains more than 1000 test cases and more than 50 different screens and we have thousands of objects on the application under test. Multiple test cases may be (more than 10) using a particular screen. If there is a change request from the client to enhance / change any of the object, then we need to update all the test cases. So its very difficult to change in Test cases.For avoiding updation in Testcases.We Create an Object Repository.If there are any changes in the application then we need to update only Object Repository.
What is Object Repository/Property File
In QTP, there is a concept called “Object Repository”. All the objects are added to Object Repository.
So how we will do this in Selenium..You will used this object repository in framework a lot.
How to use Object Repository In selenium?
Step1:Create a new Project>Click on Finish
Step2:Make a package as config>Click on Finish
Step3:Now Right Click on config(Packagename)>New>Other
Step6:Now Add the details in property file
propertyfile for gmail login..
How to use Property file
Create a new class as ReadingPropertyFile
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ReadingPropertyFile {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
//For reading property file we have to create object
//Create an object of property class
//import property files.
Properties prop = new Properties();
//Now make an object of file input stream
//import the files after creating object
FileInputStream ip = new FileInputStream("D:\\User\\workspace2\\PropertyDemo\\src\\config\\OR.properties");
prop.load(ip);
System.out.println("load all propeties");
//launch instance of any browser
WebDriver driver = new FirefoxDriver();
//now open gmail/browser
driver.get("http://gmail.com");
//now pass the xpath by property file
driver.findElement(By.cssSelector(prop.getProperty("username"))).sendKeys("ritu7180");
driver.findElement(By.cssSelector(prop.getProperty("password"))).sendKeys("password");
driver.findElement(By.cssSelector(prop.getProperty("signup"))).click();
}
}
Reading property file is very easy.
Just Follow four steps:
Just Follow four steps:
Step1:make an object of Property class
Properties prop = new Properties();
Step2:Make an Object of InputStreamClassFileInputStream ip = new FileInputStream ip();
Step3:Pass the path of propertyfile in the fileinputstream constuctor.
prop.load(ip);




It’s too informative blog and I am getting conglomerations of info’s. Thanks for sharing; I would like to see your updates regularly so keep blogging.
ReplyDeleteSoftware testing training|Software training
It was very clear to understand the concept of object repository property.
ReplyDeleteRegards,
Qtp training in Chennai|Qtp training |Loadrunner Training in Chennai
Its really crystal clear blog, keep blogging.
ReplyDeleteSelenium Training Chennai|software testing selenium training
I agree with your post, the Introduction of automation testing product shortens the development life cycle. It helps the software developers and programmers to validate software application performance and behavior before deployment. You can choose testing product based on your testing requirements and functionality.
ReplyDeleteQtp training in Chennai|Qtp training |Loadrunner Training in Chennai
very usefull informatation in this Blog about Java
ReplyDeleteNice blog… Very useful information is providing by ur blog..
ReplyDeleteCCNA Training Institute in Chennai | CCNP Training Institute in Chennai | No.1 CCNA Training in Chennai | Best CCNP Training in Chennai
This information really worth saying, i think you are master of the content and thank you so much sharing that valuable information and get new skills after refer that post.
ReplyDeleteCCNA Training in Chennai
If you are search any training institute in noida than Webtrackker is the best option for you.
ReplyDeleteSalesforce training institute in noida
Java training institute in noida
Software Testing Training institute in Noida
Qtp training institute in noida
Python Training Institute in Noida
SEO Training institute in noida
Amazon Web Services training Institute in Noida
Australia best tutor is well known academic portal. Here students can get different kind of Online Assignment help services like that
ReplyDelete1.Online Assignment Help
2.Instant Assignment Help
3.Assignment Help
4.Help with Assignment
5.my assignment Help
And also access that services at any time and any where.
Very useful guidelines. Thank you for sharing.
ReplyDeleteBest Java Training in Chennai | Best Java Training Institute in Chennai | Java Classes in Chennai
Best Digital Marketing Training Institutes in Noida - As the virtual marketing field maintains to develop at a fast pace, entrepreneurs are springing with new possibilities.
ReplyDeleteBest Php Training Institutes in Noida
Best Digital Marketing Training Institutes in Noida
Best Hadoop Training Institutes In Noida
Best Sas Training Institutes in Noida
Best Sap Training Institutes in Noida
Best Linux Training Institutes in Noida
Best Salesforce Training Institutes in Noida
Best Software Testing Training Institutes In Noida
Best Python Training Institutes in Noida
ReplyDeleteBest Oracle Training Institutes in Noida
Best Android Training Institutes in Noida
Best Web Design Training Institutes in Noida
best java training institutes in noida
best sap mm training institutes in noida
best sap sd training institutes in noida
best sap hr training institutes in noida
best tableau training institutes in noida
ReplyDeletebest automation anywhere training institutes in noida
best rpa training institutes in noida
best blue prism training institutes in noida
best angularjs 5 training institutes in noida
best net training institutes in noida
best aws training institutes in noida
best cloud computing training institutes in noida
Thanks for posting your valuable information.keep updating such an wonderful article..DotNet Project Center in Chennai | DotNet Project Center in Velachery
ReplyDeleteYour good knowledge and kindness in playing with all the pieces were
ReplyDeletevery useful. I don’t know what I would have done if I had not
encountered such a step like this.
white label website builder
wow...nice blog, very helpful information. Thanks for sharing.
ReplyDeleteDigital Transformation Services | Austere Technologies
VERY INFORMATIVE BLOG. KEEP SHARING SUCH A GOOD ARTICLES.
ReplyDeleteIOT Services | Austere Technologies
This is really great informative blog. Keep sharing.
ReplyDeleteBest Quality Managment Services | Austere Technologies
Looking really very informative blog impressed with the article just keep do sharing on...
ReplyDeleteBest Online Software Training Institute | Python Training
ReplyDeleteKeep sharing such type of useful information
Linux Admin Training in Chennai
Awesome Blog, you have provided the right information that will be beneficial to us. Thanks for sharing your valuable Ideas to our vision. Comptia Network+ Certification Courses in Chennai | Best N+ Courses in Tambaram
ReplyDeleteThis is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information, this is useful to me..
ReplyDeleteAndroid Certifications Exam Center in Chennai | Best Android Exam in Mandaveli
Wonderful blog... keep on sharing...
ReplyDeleteCorelDraw Graphics Suite Certifications Center in Chennai | No.1 CorelDraw Courses in Saidapet
Awesome post it's really useful from me..Kindly keep sharing such a nice post..
ReplyDeletePython Certifications Training Institute in Chennai | Python Coaching in Chromepet
Wow...What an excellent informative blog, really helpful. Thank you.
ReplyDeleteBest Commerce College in Hyderabad | Avinash College of Commerce
very useful information. i am expecting more posts like this please keep updating us.......
ReplyDeleteISTQB Certifications Center in Chennai | ISTQB Training in Taramani
Excellent post which helps me to get the in depth knowledge about the technology..
ReplyDeletePython Certifications Exam Cost in Chennai | NO.1 Python Coaching in Adyar
very useful information. i am expecting more posts like this please keep updating us....
ReplyDeleteNo.1 ISTQB Certifications Exam Course in Chennai | Testing in Thiruvanmiyur
awesome stuff , thanks for sharing
ReplyDeleteAdobe InDesign Certification Courses in Chennai | No.1 InDesign Training in Adambakkam
Hi Thanks for the nice information its very useful to read your blog. We provide best Chartered Accountancy
ReplyDeleteHi Thanks for the nice information its very useful to read your blog. We provide best Certified Financial Analyst
ReplyDeleteThank you for sharing this valuable information. But get out this busy life and find some peace with a beautiful trip. book ANDAMAN TOUR PACKAGE @24599
ReplyDeleteThank you for sharing this valuable information. But get out this busy life and find some peace with a beautiful trip. book BEST ANDAMAN HONEYMOON PACKAGE @5999
ReplyDeleteHi Thanks for the nice information its very useful to read your blog. We provide Software Development Services
ReplyDeleteHi Thanks for the nice information its very useful to read your blog. We provide best Chartered Institute Of Management Accountants
ReplyDeleteI am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
ReplyDeletepython training in hyderabad
Excellent informative blog, keep for sharing.
ReplyDeleteBest System Integration services | Massil Technologies
It is very nice blog. The content of this blog is helpful for us with the informative and valuable information. Share your information and keep going on. Python Online Training
ReplyDeleteHii…It was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly
ReplyDeletepython training in hyderabad