ChromeDriver 76.0.3809.68 使用 SelectByVisibleText 方法时抛出异常:脚本返回意外结果
2019-08-01
1460
我已将 selenium chromedriver 更新至 76.0.3809.68,现有测试开始失败,新的
Select(webElement).selectByVisibleText(value)
失败并出现以下异常
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);
}
3个回答
我遇到了同样的问题,但降级驱动程序版本后工作正常:Chrome 是 76(76.0.3809.100),驱动程序是 75(75.0.3770.140)
Katsiaryna Piotukh
2019-08-14
实际上并非修复,但这是由于针对问题 3084 所做的修复:使用prototype.js 1.6.1 时,在 ChromeDriver 76 中查找元素无法正常工作 [Pri-2]
,选择标签不起作用。仅存在
prototype.js` 就足以导致失败。您可以尝试以下操作来重新创建
<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>
错误:
org.openqa.selenium.WebDriverException: unknown error: script returns unexpected result
(Session info: chrome=77.0.3865.75)
如果您可以控制应用程序,则可以升级
prototype.js
的版本。
s1n7ax
2019-09-17
在将 Chrome 更新至版本 76.0.3809.87 并将驱动程序更新至最新版本后,我遇到了同样的问题,但运行正常
Mallikarjun
2019-08-03