I have a Situation where my String is getting merged with symbol '»' after running a script. So after detecting an element from Drop-down element i have to Select it only by visible Text but i have to add » before my String.
Is their any way to handle this?
You can do one thing in such a case:
WebElement web = driver.findElement(By.xpath("//select"));
List<WebElement> lst2 = web.findElements(By
.xpath(".//option[contains(text(),'<yourText>')]"));
for (WebElement option : lst2) {
if (!option.isSelected()) {
option.click();
}
}
Hope this would help, thanks.