- Adding an Object
- Removing an Object
- Updating an Object
- View Available Objects
How to Use
Let’s start with an example by Testing WordPress Website for adding and deleting a post.
Step 1:
Download the sample Eclipse project for WordPress [SOB Sample Demo Download Link]
Import the Project into Eclipse
After importing you can see three Java Files
- atu.selenium.scripts.WithoutObjectBank
- com.test.Testing
- objects.mapper.com.test.HasTestingObjects
Download the latest Selenium Server Standalone jar file and add it to your Build Path
[Selenium Server Standalone Jar Link]
Download the SOB jar file and add it to your Build Path [SOB Jar File Download Link]
- The first class atu.selenium.scripts.WithoutObjectBank is a sample Selenium WebDriver script without using SOB
- The Second class com.test.Testing is the same Selenium WebDriver script with SOB features
- The Third class objects.mapper.com.test.HasTestingObjects is generated automatically by SOB
Step 2:
Right click on the com.test.Testing java and Select Selenium Object Bank Manager as shown in below figure
Once you select, SOB window appears as shown below
- From the SOB window you can see the available Objects in the left Pane
- When you click on any Object from the left pane, you can see the Object details and the Element Tag type from the Properties table and the Select Box
- To Add an Object, Enter a Unique Object Name in the field, Select the element tag type, enter the attribute and its value (you can add more than one locator)and click on Add button
- To Remove an Object from the Available Objects, Select one of them and click on Remove button
- To Update an Object Attribute or Value, Select any object from the left pane and edit values from the Properties table
- The Clear Fields button is used when you want to clear the Properties and Object Name field. (While Adding an Object)
How does SOB work?
- Create a WebDriver Script
- Right Click on the Script and select Selenium Object Bank Manager, since it is a newly created script it pops up a message box like below as it does not have an Object Bank associated with it.
- Click on Yes to Create an Object Bank for the Script
- After clicking on Yes button, a Directory Named ObjectBank is created in the project folder. Under this ObjectBank directory, an XML file is generated that stores the Object details for the corresponding script
- The XML file name is same as the Script name and its directory structure is same as the Script package structure
- Along with this XML file, for each Script, a corresponding java file named Has[Script Name]Objects is generated under the objects.mapperpackage. The script’s directory structure is same as its package structure.
- For example: if the script name is com.test.Registration.java then
- An XML file is generated in ObjectBank\com\test\Registration.xml
- A Java file is generated in objects\mapper\com\test\HasRegistrationObjects.java under src package
Future Scope for SOB
Well, we are using this approach for our Projects and will be continued in future :)
A whole lot of new features will be introduced into SOB to the benefit of various Clients, Organizations, and Users including myself. Stay tuned :)
We love WebDriver, as an Open Source tool, we love to keep its utilities Open Source.