量角器: 5.4.1 Selenium: 3.14 geckodriver: 0.23浏览器: firefox
嗨,当执行以下代码时,我收到一个错误"Failed: sendKeysToActiveElement“
browser.actions().keyDown(protractor.Key.CONTROL).click(elements).keyUp(protractor.Key.CONTROL).perform()
但是,如果我试图使用selenium而不是量角器来运行它,那么它可以使用以下代码
driver.actions({bridge:true}).keyDown(webdriver.Key.CONTROL).click(elements).keyUp(webdriver.Key.CONTROL).perform();
以前有人在这方面有经验吗?
发布于 2018-11-01 15:17:09
Protractor和Selenium JS代码片段的不同之处在于,表单不执行桥模式中的操作,而后者则执行这些操作。
从硒资料来源: v3.14,
* In bridge mode, {@link #perform perform()} will first attempt to execute the
* configured action sequence using the W3C action protocol. If this is rejected
* by the remote end, the sequence will be translated to and executed against
* the legacy protocol.看来Gecko可能不支持W3C动作协议,而动作中的错误是抛出。
if (this.bridge_
&& (ex instanceof UnknownCommandError
|| ex instanceof UnsupportedOperationError)) {
return executeLegacy(this.executor_, this.sequences_);
}
throw ex;尝试以桥模式运行您的动作,以便进行量角器测试。
actions = browser.actions({bridge: true})
actions.keyDown(protractor.Key.CONTROL)
.click(elements)
.keyUp(protractor.Key.CONTROL)
.perform()https://stackoverflow.com/questions/53102713
复制相似问题