.keys() is misbehaving (i.e. not working) in nightwatch
Asked 07 September, 2021
Viewed 659 times
  • 56
Votes

So currently I have a test that logs into gmail (terrible idea but required) and searches the gmail inbox for the specific titles. We have been using gmail keyboard shortcuts to do this. Here is the method that works in v0.9.21 nightwatch (currently in a page object) -

        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');
        }

I recently created a branch and then upgraded to v1.7.8 nightwatch and it fails completely and my feeble brain cannot understand the error, which is -

   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...

And cannot get it to work at all. Am I missing a dependency to get "browser.keys()" to work?

Also I have seen the idea of "browser.keys(browser.Keys.ENTER)" and I receive the same error and doesn't seem to offer other keyboard actions like https://www.w3.org/TR/webdriver/#keyboard-actions

0 Answer