Post

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

By Rafaela Azevedo
Hello my friends :)
I hope that you are ok !! I will post today a technique to save the webelements in one file, or in various files but more organized and with this is easier to do maintenance when the website have some xpath, id, classname, tagname or link modified. I used this repository on xml in Bovespa. In this post I will show 2 ways to do this repository:

First – Create a class with the objects:

– Create the project, you may follow the structure bellow:

– Create a class under testObjects Package (PageLogin.java)
– Create a class under testScripts Package (TestPageLogin.java)
– Open your PageLogin.java and write the code :

Don’t forget the package of this class is testObjects, so put in the first line:
package testObjects;

– After this, open TestPageLogin.Java and write :

Don’t forget the package of this class is testScripts, so put in the first line:
package testScripts;

Second – Create a OR file (You can use XML too)

– Create the project, you may follow the structure bellow:

– Create a text file with the Extension as .OR under the object Repository Package (in this case: com.sagara.objectrepository)

– Create a java class under test Pages package (in this case: com.sagara.testPages)

– Open your .OR file and write the objects informations with a structure like this:

– Open your class Java and write the below code to get the objects information’s from the OR file and use it:

I hope that I has helped, if you have some doubts just let your comment :)
Bye guys !
Font: http://way2automationtesting.blogspot.in/2014/02/creating-object-repository-in-selenium.html

Source: http://azevedorafaela.wordpress.com/2014/02/11/2-ways-to-make-a-repository-of-webelements-webdriver/

Category: Programming, QA, Test and Automation Stuffs, repository in classes webdriver, repository in Or file webdriver, repository of elements in classes webdriver, repository of elements selenium, repository of elements webdriver, Repository of objects, Repository of webelement selenium, repository of webelements, repository of webelements webdriver

Você também pode querer ler

Comments are off for this post.