angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

UnsupportedOperationError Cannot call non W3C standard command while in W3C mode #5440

Open tfaron opened 4 years ago

tfaron commented 4 years ago

Bug report

Webdriver-manager 12.1.7

  1. start the webdriver
  2. Navigate localhost:4444/wd/hub
  3. Click create session button and select chrome
  4. obtain the session id

on the command line I execute the following command to utilize the previously created session C:\svt-web-client\projects\client-ng\node_modules.bin\protractor C:\svt-web-client\projects\client-ng\protractor.e2e.atf.conf.js --grep "C512473_OMNI_84_1" --seleniumSessionId=3a06632775a9597412156107fc59d809 '

I get the following error: [09:48:53] I/launcher - Running 1 instances of WebDriver [09:48:53] I/attachSession - Using the selenium server at http://127.0.0.1:4444/wd/hub [09:48:53] I/attachSession - Using session id - 3a06632775a9597412156107fc59d809 [09:48:53] E/runner - Unable to start a WebDriver session. [09:48:53] E/launcher - Error: UnsupportedOperationError: unknown command: Cannot call non W3C standard command while in W3C mode Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'FARON-GUIAUTOMA', ip: '16.100.207.69', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_251' Driver info: driver.version: unknown at Object.checkLegacyResponse (C:\svt-web-client\projects\client-ng\node_modules\selenium-webdriver\lib\error.js:546:15) at parseHttpResponse (C:\svt-web-client\projects\client-ng\node_modules\selenium-webdriver\lib\http.js:509:13) at doSend.then.response (C:\svt-web-client\projects\client-ng\node_modules\selenium-webdriver\lib\http.js:441:30) at process._tickCallback (internal/process/next_tick.js:68:7) [09:48:53] E/launcher - Process exited with error code 100

If i set w3c to 'false' i can get around this issue but I assume an update is required in the area of connection to an exiting session to use updated w3c standards/calls

David-Siebert commented 3 years ago

Hi @tfaron

In our project we have the same Issue you described. Do you have receive any reaction or feedback from the Protractor Team?

We currently use a different environment:

We would also set w3c to 'false', but we don't know how? Should we set it in the protractor.conf.js or the spectron Application initializer? And how exactly?

jcernea commented 3 years ago

Hi @tfaron

In our project we have the same Issue you described. Do you have receive any reaction or feedback from the Protractor Team?

We currently use a different environment:

  • electron version: 11.1.1
  • protractor version: 7.0.0
  • spectron version: 13.0.0
  • angular version: 11.0.6

We would also set w3c to 'false', but we don't know how? Should we set it in the protractor.conf.js or the spectron Application initializer? And how exactly?

My set-up is very similar, just different in versions. To get pre-created protractor tests running I had to do a lot of tweaking, most confusing one being the w3c issue too. Couldn't find the means to specify 'w3c: false' in spectron so here is a small hack that worked for me:

in node_modules/spectron/application.js you should see an options object (LN 196) just add the w3c: false value there:

 const options = {
  hostname: self.host,
  port: self.port,
  waitforTimeout: self.waitTimeout,
  connectionRetryCount: self.connectionRetryCount,
  connectionRetryTimeout: self.connectionRetryTimeout,
  logLevel: 'silent',
  capabilities: {
    'goog:chromeOptions': {
      binary: launcherPath,
      args: args,
      debuggerAddress: self.debuggerAddress,
      windowTypes: ['app', 'webview'],
      w3c: false
    }
  },
  logOutput: DevNull()
};

I saw no way to do it through Spectron App initialization.

Also I had to comment out a section in the same file to avoid errors during launch (it'll probably bite me in the back later):

  return self
    .exists()
    .then(function () {
      return self.startChromeDriver();
    })
    .then(function () {
      return self.createClient();
    })
    .then(function () {
      return self.api.initialize();
    })
    .then(function () {
     // return self.client.setTimeouts(
     //   self.waitTimeout,
     //   self.waitTimeout,
     //   self.waitTimeout
     // );
    })
    .then(function () {
      self.running = true;
    })
    .then(function () {
      return self;
    });

I welcome any alternative solutions, maybe someone knows how to do this without modifying Spectron source :) ?