How to read XML file data in Java || How to create object repository in selenium

As most of the commercial automation tools has feature of object repository concept, which separate application objects from automation scripts, it help us to modify object when AUT object change without going into code.  Also if we create object repository then it reuse throughout scripts from one place.

In Webdriver we can put locator (object) of web elements in to xml, properties, excel file etc at one place, and can separate from test scripts with logically divided into files.

In this post I am going to show you how to read data and put locators into xml files.

We create xml files for object locator like “Header.xml” where put all locators related to header menus, “Login.xml” for locators of login page, “Dashborad.xml” for locator of dashboard page.

Codeception webdriver integration

In my previous post of codeception, I posted that how to setup and create codeception acceptance test using phpbrowser. As phpbrowser has following limitation:

  • Can click only on links with valid urls or form submit buttons
  • Not support input fields that are not inside a form
  • Not support JavaScript interactions, like modal windows, datepickers, etc.

So we can integrate codeception with selenium webdriver and can easily handle phpbrowser drawbacks