I want to select an from and click on button, Super easy right?
But I have a situation in which my dropdown does not have a default “Select” option and by default an option is already in dropdown. When I use deselectby methods, system returns
“You may only all options of a multi-select”.
Anyway I can deselect that default option and select any other option from the dropdown?
My code is given below! Thanks!

{
driver.get(URL);

    driver.findElement(By.xpath("//*[@id="two"]/div/div/section/div[1]/div[5]/div[2]/a/img")).click();

    Select S1 = new Select(driver.findElement(By.id("enterpriseId")));

    S1.deselectByIndex(1);

    S1.selectByIndex(2);

    driver.findElement(By.xpath("//*[@id="selectProvidersDiv"]/div/input[3]")).click();

    Thread.sleep(5000);

    driver.quit();

}



Source link https://sqa.stackexchange.com/questions/34772/deselect-a-selected-option-from-drop-down-in---

LEAVE A REPLY

Please enter your comment!
Please enter your name here