Webdriver Script to work on CheckBox, ReadioButton, Dropdownlist, Listbox example :-
Now I am providing Live example to work on ListBox, DropDownList, CheckBox and RadioButton.
package scs;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class SearchRoom {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "c://chromedriver.exe");
WebDriver scs= new ChromeDriver();
scs.get("https://shivaconceptsolution.com/test.html");
Select cat = new Select(scs.findElement(By.name("c")));
cat.selectByIndex(1);
Select cat1 = new Select(scs.findElement(By.name("c[]")));
cat1.selectByIndex(1);
cat1.selectByIndex(2);
cat1.selectByIndex(3);
scs.findElement(By.name("chk2")).click();
scs.findElement(By.cssSelector("input[value='FeMale']")).click();;
//scs.findElement(By.className("btn-one w-100")).click();;
}
}
POST Answer of Questions and ASK to Doubt