Google+

352. Selecting values from the Drop down list by locating the Drop down field using XPath Statement








Lets write a Sample Program which locates the Drop down field on the web page using XPath Statement and select the list item from the list.

Test Description:

First of all lets understand the Test Description by going through the comments mentioned on the below screenshot.





Lets Implement the Test on Eclipse IDE:

Pre-requisites:

1. Create a new Project say 'WebDriver-Project19' in Eclipse IDE
2. Configure the Project to work with Selenium WebDriver
3. Create a package say 'package19' under the newly created project.
4. Create a Java Class file say 'Class19' under the newly created package as shown below: 





Actual Steps:

1. Ensure that you already know how to use the Selenium predefined method sendKeys( ) for selecting a list item from the drop down list. If not please refer to the posts #33 before going to the next steps.

2. Write the following code into the newly created Java Class file as shown below and make sure that you resolve all the errors before going to next step:




3. Write the test method 'selectSeleniumGridFromDropDownList()' which uses XPath Statements for locating the Drop down  field as shown below:




4. Save and Run the 'Class19.java' file by selecting the 'JUnit Test' option and ensure that our Automation Test has selected 'Selenium Grid' from the Drop down list as shown in the below video:

Watch the below video:

Click here to watch the video.

Download this Project:


Click here to download this project and import into Eclipse IDE  on your machine.





Please comment below to feedback or ask questions.

Clicking a link by locating it using XPath statement will be explained in the next post.




3 comments:

Anonymous said...

CAN I GET A FRESHER COMPLETE SELENIUM HYBRID FRAMEWORK PROJECT ON SELENIUM , I JUST JOINED A COMPANY CURRENTLY IM GETTING WHT I USED TO GET FROM INSTITUTE SO KINDLY RENDER SOME REAL TIME PROJECT FROM SCRATCH LIKE CREATING HYBRID FRAMEWORK AND USING TESTNG REPORTING TOOL IN SELENIUM PROJECT I WANT EIETHER VIDEO OR SCREENSHOT LIKE U DO

Anonymous said...
This comment has been removed by a blog administrator.
Shubham Jadhav said...

Hello Arun, is the projects not available now as if I clicked on the link for download project it won't work.