3

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);
}
Dev
  • 2,739
  • 2
  • 21
  • 34
vini007
  • 595
  • 1
  • 6
  • 13

6 Answers6

2

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)

1

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.

s1n7ax
  • 2,750
  • 6
  • 24
  • 53
0

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

0

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.

Vincent Gerris
  • 7,228
  • 1
  • 24
  • 22
0

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.

Madhur Bhaiya
  • 28,155
  • 10
  • 49
  • 57
0

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