Selenium Object Bank Manager
Selenium Object Bank objectives
· Storing all the Objects in a central location
· Changing Object properties without any modification on the Script
· Readability and clear understanding of the automation steps performed by just looking into the Script
· Minimizing the Script code by Object notation
· Creating Robust Scripts
· Re usability of the Objects
· Identifying the Objects with different locators other than those provided by Web Driver (id, name, xpath, css, class, tagName)
Installing the Plug-In
Selenium Object Bank is available as a Plugin for Eclipse IDE. You must follow few steps
1) You need to download plug-in from below path
https://docs.google.com/file/d/0B7rZvkq9tkwPa3ZlNnp0MHlFU2M/edit?pref=2&pli=1
Note: if it is taking too much of time to load the page use other browsers
2) Click on the download button

3) Save the zip file to your local drive and extract the folder.
4) Now open the eclipse. Go to Helpà Install New Software..

5) You should see a window with ‘Add’ button. On clicking ‘Add’, you should see a pop up ‘Add to Repository ‘which allows you to add the downloaded Plugin. Just click on Local and browse the extracted zip.

6) Once the Plugin directory is selected, the path is shown in the small window. Click on ‘Ok’ button.

7) After clicking “Next” button, here it takes some time for calculating requirements and dependencies.After the process is done click on “Next” button.Next accept the license agreement by selecting the “Accept” radio and then Click on “Finish” button.
During the installation it might give a Warning message. Click on OK button.
1) Create a Project
2) Associate all required jar files to that project
a) Selenium Standalone jar file
b) Selenium Object Bank jar file
c) TestNG jar file (If your running your test through TestNG)
d) Selenium-java client files
3) Folder structure will be like this

4) Right click on the class (SOBTest.java) the select Selenium Object Bank Manager.

5) Selenium Object Bank Manager window appears
If it is newly created , it will show below alert message, then click on Yes.

Selenium Object Bank Manager window

a) Object Name should be unique
b) Select the tag name
c) Enter the attribute name and value(id,name,xpath,css etc.,)
d) Once click on Add button, Object details will be move to Available Objects


Then close the Selenium Object Bank Manager.
e) refresh the Eclipse Project folder to see the newly created files
f) An XML file is generated in ObjectBank\SOB\SOBTest.xml
g) A Java file is generated in Objects.mappers.SOB\HasSOBTestObjects.java under src folder.
· Storing all the Objects in a central location
· Changing Object properties without any modification on the Script
· Readability and clear understanding of the automation steps performed by just looking into the Script
· Minimizing the Script code by Object notation
· Creating Robust Scripts
· Re usability of the Objects
· Identifying the Objects with different locators other than those provided by Web Driver (id, name, xpath, css, class, tagName)
Installing the Plug-In
Selenium Object Bank is available as a Plugin for Eclipse IDE. You must follow few steps
1) You need to download plug-in from below path
https://docs.google.com/file/d/0B7rZvkq9tkwPa3ZlNnp0MHlFU2M/edit?pref=2&pli=1
Note: if it is taking too much of time to load the page use other browsers
2) Click on the download button
3) Save the zip file to your local drive and extract the folder.
4) Now open the eclipse. Go to Helpà Install New Software..
5) You should see a window with ‘Add’ button. On clicking ‘Add’, you should see a pop up ‘Add to Repository ‘which allows you to add the downloaded Plugin. Just click on Local and browse the extracted zip.
6) Once the Plugin directory is selected, the path is shown in the small window. Click on ‘Ok’ button.
7) After clicking “Next” button, here it takes some time for calculating requirements and dependencies.After the process is done click on “Next” button.Next accept the license agreement by selecting the “Accept” radio and then Click on “Finish” button.
During the installation it might give a Warning message. Click on OK button.
8) After installation restart the eclipse.
9) Once it’s done, you should see Selenium Object Bank Manageron right clicking any class.
How to use
How to download Selenium Object Bank Jar file
1) First download Selenium Object Bank Jar files from below path
https://docs.google.com/file/d/0B7rZvkq9tkwPM05fNVRzYXQ3dU0/edit?pref=2&pli=1
Note: if it is taking too much time to load the page use other browsers
2) Save the zip file to your local drive and extract the folder.
1) Create a Project
2) Associate all required jar files to that project
a) Selenium Standalone jar file
b) Selenium Object Bank jar file
c) TestNG jar file (If your running your test through TestNG)
d) Selenium-java client files
3) Folder structure will be like this
4) Right click on the class (SOBTest.java) the select Selenium Object Bank Manager.
5) Selenium Object Bank Manager window appears
If it is newly created , it will show below alert message, then click on Yes.
Selenium Object Bank Manager window
a) Object Name should be unique
b) Select the tag name
c) Enter the attribute name and value(id,name,xpath,css etc.,)
d) Once click on Add button, Object details will be move to Available Objects
Then close the Selenium Object Bank Manager.
e) refresh the Eclipse Project folder to see the newly created files
f) An XML file is generated in ObjectBank\SOB\SOBTest.xml
g) A Java file is generated in Objects.mappers.SOB\HasSOBTestObjects.java under src folder.
Java Code when using with Selenium Object Bank
Compelete Code:
package SOB;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.chrome.ChromeDriver;
importorg.testng.annotations.Test;
importobjects.mapper.SOB.HasSOBTestObjects;
importatu.sob.exceptions.ObjectBankException;
importatu.sob.exceptions.ObjectFinderException;
publicclassSOBTest {
HasSOBTestObjectshas=newHasSOBTestObjects();
@Test
publicvoidtestlogin() throwsInterruptedException, ObjectBankException, ObjectFinderException{
WebDriver driver;
System.setProperty("webdriver.chrome.driver", "E:\\software\\selenium\\Chromev28\\chromedriver.exe");
driver = newChromeDriver();
String url="https://www.facebook.com/";
driver.get(url);
Thread.sleep(500);
driver.manage().window().maximize();
has.setWebDriverObject(driver);
has.fblogin().sendKeys("admin");
has.fbpass().sendKeys("test");
has.fbloginbtn().click();
}
}
Bits
1) To Remove an Object from the Available Objects, select one of them and click on Remove button
·2) To Update an Object Attribute or Value, Select any object from the left pane and edit values from the Properties table
·3) The Clear Fields button is used when you want to clear the Properties and Object Name field. (While Adding an Object)
Comments
Post a Comment