Unable to select value from select tag. Getting Exception-WebDriverException: unknown error: a.tagName.toUpperCase is not a function

你离开我真会死。 提交于 2019-12-24 11:06:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!