WebDriver driver=new FirefoxDriver();
driver.get("http://192.168.0.133/tiyorelease3");
WebElement ListBox = driver.findElement(By.className("dropdown-toggle")); Select Select = new Select(ListBox);
Select.selectByVisibleText("Bangalore");
1 Answer
This exception generally occurs when we use Select command to select dropdowns which are not built by using "select" tag.
You can try by using sendkeys to select dropdown, just give displayed text of option in sendkeys.
If above does not work, then go for click on dropdown and again click on required option.
If it is auto complete dropdown, then click on that dropdown input box and go for senkeys char by char with small sleep, so that required option will be displayed.
You can try following code in your case:
WebElement ListBox = driver.findElement(By.className("dropdown-toggle"));
ListBox.sendKeys("Bangalore");
1 Comment
RNS
Code is added in the answer
http://192.168.0.133/tiyorelease3. Can you please confirm its a public URL? Thanks