在firefox上,browser.keys抛出错误。
Os: MacOs Firefox version: 53.0.3 Geckodriver: 0.16.1 Webdriver.io: 4.8
请帮我解决这个错误。
以下是日志
[17:11:35] COMMAND POST "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/url" [17:11:41] COMMAND POST "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/refresh" [17:11:45] COMMAND GET "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/window/current/size" [17:11:46] COMMAND POST "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/elements" [17:11:46] COMMAND GET "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/element/0/displayed" [17:11:46] COMMAND GET "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/element/1/displayed" [17:11:46] COMMAND POST "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/elements" [17:11:46] COMMAND GET "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/element/0/displayed" [17:11:46] COMMAND GET "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/element/1/displayed" [17:11:46] COMMAND POST "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/elements" [17:11:47] COMMAND POST "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/element/0/value" WARNING: the "keys" command will be depcrecated soon. Please use a different command in order to avoid failures in your test after updating WebdriverIO. [17:11:47] COMMAND POST "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/keys" [17:11:47] COMMAND GET "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/screenshot" [17:11:48] Saved screenshot: ERROR_firefox_2017-06-03T00-11-47.734Z.png [17:11:48] COMMAND DELETE "/wd/hub/session/97804a03-d52a-4232-9e3c-41e1fac6a9c5/cookie" Error: sendKeysToActiveElement Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'xxx.local', ip: '10.142.4.252', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.5', java.version: '1.8.0_131' Driver info: driver.version: RemoteWebDriver Error: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource. at Object.wait (/Users/xxxx/c3web/xxxx/node_modules/fibers/future.js:449:15) at Object.keys (/Users/xxxxx/node_modules/wdio-sync/build/index.js:264:31) at Object.exports.customCommands.selector (/Users/xxx/c3web/xxxx/testlib/browser/customCommands.js:158:17) at /Users/xxxx/node_modules/wdio-sync/build/index.js:191:29 - - - - - at keys("Enter") - index.js:244:37 at elementIdValue("0", "xxxyyyzzz") - index.js:293:3
答案 0 :(得分:0)
嗯,这个错误几乎解释了keys
命令的实现存在问题:WARNING: the "keys" command will be depcrecated soon. Please use a different command in order to avoid failures in your test after updating WebdriverIO.
。
它目前仅在我的测试用例中使用chromedriver
,但我也无法使用它链接命令。 (模拟Ctrl+C
,Ctrl+V
)。
在 this 问题上查看我的回答。你必须找到另一种解决方法,或者等待驱动程序( chromedriver , geckodriver 等)来实现新的Selenium {{1 }} 方法。
我在那里给出的答案几乎涵盖了整个问题。或者,您可以尝试 codepoint 方法:actions
。
希望这能帮到你!
答案 1 :(得分:0)
尝试使用webdriverio版本> v4.9.3,看起来像他们修复了它: https://github.com/webdriverio/webdriverio/commit/1f1db4583f62c60c7907f14c080603376e7ec52b