问题
Am using chrome driver and windows 10 OS. By using select class am able to find options from the select tag. but unable to chose the options by index or visibleText or any.
<select class="pull-left" name="status">
<option value="">Status</option>
<option class="select-value" value="Valid" >Valid</option>
<option class="select-value" value="Ivalid">Invali</option>
</select>
Selenium Code-
@FindBy(xpath="//select[@name='status']")
WebElement drop;
Select sel=new Select(drop);
List<WebElement> ls=sel.getOptions();
for (WebElement webElement : ls) {
System.out.println(webElement.getText());
}
sel.selectByVisibleText("Status");
Console Output:-
org.openqa.selenium.WebDriverException: unknown error: a.tagName.toUpperCase is not a function
(Session info: chrome=56.0.2924.87)
(Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 10.0.14393 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 55 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
来源:https://stackoverflow.com/questions/42227005/unable-to-select-value-from-select-tag-getting-exception-webdriverexception-un