@Test
public void testDropdownselectvalue()throws Exception {
selenium.open("http://www.google.com");
selenium.windowMaximize();
selenium.click("link=Advanced Search");
selenium.waitForPageToLoad("50000");
// Print all the available options from the results dropdown in the
String[] options = selenium.getSelectOptions("name=num");
// The above command returns a array of strings(options)
for (int i = 0; i < options.length; i++) {
System.out.println("Option: " + i + " is " + options[i]);
}
//select value from dropdown
selenium.select("num", "label=30 results");
//Print the selected value from dropdown
String s=selenium.getSelectedValue("name=num");
System.out.println("selected value is "+s);
public void testDropdownselectvalue()throws Exception {
selenium.open("http://www.google.com");
selenium.windowMaximize();
selenium.click("link=Advanced Search");
selenium.waitForPageToLoad("50000");
// Print all the available options from the results dropdown in the
String[] options = selenium.getSelectOptions("name=num");
// The above command returns a array of strings(options)
for (int i = 0; i < options.length; i++) {
System.out.println("Option: " + i + " is " + options[i]);
}
//select value from dropdown
selenium.select("num", "label=30 results");
//Print the selected value from dropdown
String s=selenium.getSelectedValue("name=num");
System.out.println("selected value is "+s);
}
Super.. thanks for ur code..
ReplyDeleteHey Punuru ... Ur welcome :)
ReplyDeleteHi Sai,
ReplyDeleteI have an issue in selecting dropdown. When i select a value in dropdown, it should display a button. But this event is not occuring. I tried using blur, Focus and all... Need a help from you!!