id of drop down = "rw_520631" Value which I want to select from drop down is = "Automation RW (0/6)"
Now here "Automation RW" is static but "(0/6)" can change. How can I select this using selenium webdriver in JAVA
id of drop down = "rw_520631" Value which I want to select from drop down is = "Automation RW (0/6)"
Now here "Automation RW" is static but "(0/6)" can change. How can I select this using selenium webdriver in JAVA
This question was answered here - Selenium Select - Selecting dropdown option by part of the text
Below is the snippet of the answer:
List <WebElements> optionsInnerText= driver.findElements(By.tagName("option"));
for(WebElement text: optionsInnerText){
String textContent = text.getAttribute("textContent");
if(textContent.toLowerCase.contains(expectedText.toLowerCase))
select.selectByPartOfVisibleText(expectedText);
}