ChromeDriver 76.0.3809.68 is throwing exception with SelectByVisibleText method: Script returns unexpected result

寵の児 提交于 2019-12-19 09:57:32

问题


I have updated the selenium chromedriver to 76.0.3809.68 and the existing tests started to fail with new Select(webElement).selectByVisibleText(value) is failing with the following exception

org.openqa.selenium.WebDriverException: unknown error: script returns unexpected result
  (Session info: chrome=76.0.3809.87)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'VARGHESEV10', ip: '10.13.36.28', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: com.prahs.framework.PRAWebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 76.0.3809.87, chrome: {chromedriverVersion: 76.0.3809.68 (420c9498db8ce..., userDataDir: C:\Users\swqatest\AppData\L...}, goog:chromeOptions: {debuggerAddress: localhost:15612}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: cfd7ddc498272f40f9b62c43f67...}
Session ID: cfd7ddc498272f40f9b62c43f6742060
*** Element info: {Using=xpath, value=.//option[normalize-space(.) = "Test_Auto_Pv_243399_RAJ"]}


protected void selectOption(String field, WebElement selectElement, String value) {
    log.info(ReportUtils.formatAction("Select ", field, value));
    Select select = new Select(selectElement);
    select.selectByVisibleText(value);
}

回答1:


I had the same issue, but working fine after downgrading Driver version: Chrome is 76 (76.0.3809.100) and Driver is 75 (75.0.3770.140)




回答2:


Not really a fix but this is due to the fix made for issue 3084: Find Elements not working properly in ChromeDriver 76 when prototype.js 1.6.1 is used [Pri-2], select tags are not working. Just the presence ofprototype.js` is enough this to be failed. You can try the following to recreate

<html>
    <head>
        <title>test</title>
    </head>

    <body>
        <select id="sample">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
        </select>

        <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.1/prototype.js" type="text/javascript"></script>
    </body>
</html>

Error:

org.openqa.selenium.WebDriverException: unknown error: script returns unexpected result
  (Session info: chrome=77.0.3865.75)

If you have the control of the application you can upgrade the version of prototype.js.




回答3:


I was getting same issue but working as expected, after updating Chrome to Version 76.0.3809.87 and driver to latest




回答4:


I also experienced this issue with ChromeDriver 76.0.3809.68 and Chrome 76.0.3809.100. It works with ChromeDriver 76.0.3809.126 and Chrome 76.0.3809.100.




回答5:


Not just selectByVisibleText even selectByValue was also throwing the same Exception

"org.openqa.selenium.WebDriverException: unknown error: script returns unexpected result".

I faced this issue with chrome v76. I upgraded the chrome version to 77 and tested with ChromeDriver 76 and 77 which works fine now.




回答6:


I think the fix for this issue was released in chrome 76.0.3809.126, please check.



来源:https://stackoverflow.com/questions/57315463/chromedriver-76-0-3809-68-is-throwing-exception-with-selectbyvisibletext-method

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