所以目前我有一个登录到 gmail 的测试(可怕的想法,但需要)并在 gmail 收件箱中搜索特定标题。我们一直在使用 gmail 键盘快捷键来执行此操作。这是适用于 v0.9.21 nightwatch 的方法(当前在页面对象中) -
selectEmail(searchValue) {
//Using GMail Shortcuts
this.waitForElementPresent('@emailTable');
this.api.keys('/');
this.api.keys(searchValue);
this.api.keys('\uE007');
this.api.pause(2000);
this.api.keys('x');
this.api.keys('o');
}
我最近创建了一个分支,然后升级到 v1.7.8 nightwatch,它完全失败了,我微弱的大脑无法理解错误,这是 -
Response 500 POST /wd/hub/session/8b3c71c871712e5a9619f2983495851c/keys (4ms)
{
value: {
error: [
"Build info: version: '3.141.59',
revision: 'e82be7d358',
time: '2018-11-14T08:25:53'",
"System info: host: '????',
ip: '????????',
os.name: 'Windows 10',
os.arch: 'amd64',
os.version: '10.0',
java.version: '1.8.0_301'",
'Driver info: driver.version: unknown'
],
message: 'sendKeysToActiveElement'
},
status: 9
}
Error while running .sendKeys() protocol action: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the m...
并且根本无法让它工作。我是否缺少让“browser.keys()”工作的依赖项?
我也看到了“browser.keys(browser.Keys.ENTER)”的想法,我收到了同样的错误,似乎没有提供其他键盘操作,如https://www.w3.org/TR/webdriver/ #keyboard-actions