When I am trying to find element using selectByVisibleText()
method from a dropdown, the program is getting executed even if there is no such text in the dropdown. Though after execution of program it is showing an error.
HTML element:
<select id="portfolioid">
<option value="2021218" selected="selected">Ishu8</option>
<option value="2021219">Ishu7</option>
<option value="2021220">Ishu6</option>
<option value="2021221">Ishu</option>
</select>
My Code:
WebElement wb=driver.findElement(By.id("portfolioid"));
Select dropdown=new Select(wb);
dropdown.selectByVisibleText("Ishu1");
This is selecting the first element(i.e. "Ishu8") in dropdown and executing rest of the program, while it should stop the execution after an error. Rest of the scenarios are working fine