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)
Don’t forget the package of this class is testScripts, so put in the first line:
- 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