Creating a properties file in eclipse Storing data onto properties file Reading data from properties file Using properties file in test scripts Step 1 Creating a properties file in eclipse To start with, the below java project structure needs to be created in eclipse. By using our site, you acknowledge that you have read and understand our Cookie Policy , Privacy Policy , and our Terms of Service. Hi Kumar, Whatever java reads from properties file is based on key-value pair. Sign up or log in Sign up using Google. I have mentioned a xpath value in properties file as mentioned below: Could u pls help me out.

Uploader: Shaktigami
Date Added: 18 May 2012
File Size: 49.55 Mb
Operating Systems: Windows NT/2000/XP/2003/2003/7/8/10 MacOS 10/X
Downloads: 79320
Price: Free* [*Free Regsitration Required]

The below code demonstrates the usage of data read from XML file in test scripts. Reading data from XML file can be accomplished using the built-in ‘dom4j’ class in java. Sign up to get answers to your questions via experts on Edureka Community.

As for how see: I guess by object repository you mean external source a file or DB of locators for elements in your page objects. On the other side, if you want to refactor your page object e.

Complete guide to set Object Repository in Selenium Webdriver

Email Required, but never shown. By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie policyand that your continued use of the website is subject to these policies.


WebDriver ; import org. Eventhough this question is not related to this post, i would like to ask you for basic clarification. Myra Khetpal February 20, at 2: Email me if a comment is added after mine.

Kumar January 30, at 1: An object repository is a common storage location for all objects. IOException ; import java.

How to create Object Repository in Selenium Webdriver

The scenario is you have test cases and in all test cases, you have login scenario. Hi Kumar kindly check http: File ; import java. Email me if my answer is selected or commented on Privacy: There’s reepository approach is to to create reposjtory single GUI. Hi Myra, Check whether you are providing correct path for file.

The object repository concept comes from record-and-playback tools such as QTP. In this tutorial, you will learn- What is an Object Repository? Git Hub is a Collaboration platform.

The correct approach is to have the locators in each page object class as By variables or use page factory which declares the web elements and their locators together In my opinion, using object repositories in Selenium projects is a bad practice.

Send us an email at support edureka. How and why create an object repository for element locators in a Selenium project?

Which is the best way to Create object Repository in Selenium Web Driver? – Stack Overflow

I have used Selenium Implicit Wait in the starting of my script after the driver object initiated. Home Questions Tags Users Unanswered.


This process does not make any sense so to overcome with this we will move all locator in a separate file and we will link all test cases to this file. Mukesh Otwani January 31, at 1: Mukesh Otwani February 17, at 9: Actually, i wanna use this in a loop.

Creating Object Repository in Selenium WebDriver: XML & Properties file

Below is the code to read data from XML file. An object repository is a common storage ot for all objects Selenium WebDriver does not offer an in-built object repository by default You can create 2 Types of Object Repository in Selenium Object Repository using Properties file Object Repository using XML file The properties file is a text file wherein data is stored on the form of key-value pairs XML File format will replicate the HTML format upon which the webpage is constructed.

Step 4 Using properties file in test scripts Properties file can be used in test scripts by reading data from a properties file and passing the data as a parameter to the findElement method.