Steps to set up web driver and Eclipse:
- Open Eclipse from the menu choose File, New, Project...
- In the folder Java, choose Java Project.
- Give project a name, accept the rest of the defaults, and click Next.
- Download the latest zip file for selenium frm : http://seleniumhq.org/download/
- The latest version right now is : "selenium-java-2.15.0.zip"
- Unzip the files into the project that you just created
- Back in Eclipse, right click on your project in the Package Explorer and choose Build Path, Configure Build Path.... Choose the Libraries tab
- Click Add Jars
- Select all of the jars that you just unzipped into the /lib/selenium-jars/ folder and click OK
- Choose the primary selenium jar, which in this example is selenium-java-2.15.jar , expand and double-click on Javadoc location. (Enter the location for the Selenium JavaDocs into the Javadoc location path field htttp://selenium.googlecode.com/svn/trunk/docs/api/java/)
- Click Ok and u are ready.
- Right click on the /src folder in your project and choose New, Package...Give the package a name and click Finish.
- Right click on the package and choose New, Class...Give the class a name and accept the other defaults, but make sure that public static void main(String[] args) is checked.
- Add code from selenium IDE in JUnit4 (WebDriver) format
- Run the test :)
Happy Testing!!!
Hi,
ReplyDeleteI wish to set up the environment for selenium to test web based flash-flex UI.
Could you please help me in this, I am totalyy new to selenium and flash flex.
Thanks Aditya. Helped me !
ReplyDeleteYour blog is very helpful. I am automating quikr and I have a doubt.
ReplyDeleteMy doubt is that while editing any add that you posted in quikr.com, then there is a subcategory field in the add.
I think that is not a driopdown. After selecting the main category, corresponding subcategories are displayed there on the same dropdown (here i am saying dropdown but please do not get confused as that is not dropdown i think)...
Now I am unable to select any subcategory from that field.
Can you please help me out here.
Please help how to select the value here...
Hey thanks for the kind words. I checked quikr. You are right these are not drop-down elements but list items. You can access them by their ids or using XPATH like -
DeleteCategory - //*[@id='li_269']
Sub Category - //*[@id='su_227']
Hope this helps!
Hi,
DeleteThanks for quick response sir...
By using the ids I can select Category/Sub Category. But here for selecting the category, I have created a method and in my testcase I am calling that method. And for that method, my code is below:-
WebElement element = driver.findElement(By.xpath("//*[@id='subcatdiv']/ul"));
List vals = element.findElements(By.tagName("li"));
for(WebElement optionelement : vals){
System.out.println(optionelement.getText());
if(optionelement.getText().equalsIgnoreCase("Office Supplies")){
optionelement.click();
break;
}
}
But I am unable to select the category/Subcategory.
Kindly help me out here How can I achieve this.
I need your help in this.
Kindly help.
Thanks
amit