Back To Normal

Subscribe To Our E-Mail Newsletter

Tuesday, April 24, 2012

Select Object from Drop Down : Web driver


Couch ModePrint It


Select Object from Drop Down

WebElement select = driver.findElement(By.name("select"));

List options = select.findElements(By.tagName("option"));

for(WebElement option : options){

if(option.getText().equals("Name you want"){

option.click();

break;

}

Click Here For Smileys :D
:D
:)
:[
;)
:D
:O
(6)
(A)
:'(
:|
:o)
8)
(K)
(M)

2 comments:

Vijayaragavan said...

Its working fine with Internet Explorer.

Unknown said...

The webElement Option part is not working in the for loop. it says wrong datatype.
Please help me on this issue.
The issue pointed by Netbeans is:
required: org.openqa.selenium.WebElement
found: java.lang.Object

560 Free Online Courses

Top 200 universities launched 500 free online courses.  Please find the list here .