Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Investigate selenium-webdriver 2.53.1 session getCapabilities error #3173

Closed
cnishina opened this issue Apr 26, 2016 · 12 comments · Fixed by #3223
Closed

Investigate selenium-webdriver 2.53.1 session getCapabilities error #3173

cnishina opened this issue Apr 26, 2016 · 12 comments · Fixed by #3223

Comments

@cnishina
Copy link
Member

The test creates the session and fails. The session remains open.

node scripts/attachSession.js
[11:19:12] I/attachSession - Using the selenium server at http://localhost:4444/wd/hub
[11:19:12] I/attachSession - Using session id - 5fb531b7-42d9-4c5b-abc9-b7666b5b5a11
[11:19:12] I/launcher - Running 1 instances of WebDriver
[11:19:12] E/launcher - Process exited with error code 1

/Users/cnishina/protractor/scripts/attachSession.js:57
          throw new Error('Protractor did not run properly.');
          ^

Error: Protractor did not run properly.
    at IncomingMessage.<anonymous> (/Users/cnishina/protractor/scripts/attachSession.js:57:17)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:905:12)
    at doNTCallback2 (node.js:441:9)
    at process._tickCallback (node.js:355:17)

When launching the protractor test manually (with the existing session):

node bin/protractor spec/attachSession.js --seleniumSessionId=5fb531b7-42d9-4c5b-abc9-b7666b5b5a11                                                                                                    ⏎
[11:19:33] I/attachSession - Using the selenium server at http://localhost:4444/wd/hub
[11:19:33] I/attachSession - Using session id - 5fb531b7-42d9-4c5b-abc9-b7666b5b5a11
[11:19:33] I/launcher - Running 1 instances of WebDriver

/Users/cnishina/protractor/node_modules/selenium-webdriver/lib/promise.js:1343
      return callbackFn(this.value_);
             ^
TypeError: session.getCapabilities is not a function
    at /Users/cnishina/protractor/node_modules/selenium-webdriver/lib/webdriver.js:434:50
    at ManagedPromise.invokeCallback_ (/Users/cnishina/protractor/node_modules/selenium-webdriver/lib/promise.js:1343:14)
    at TaskQueue.execute_ (/Users/cnishina/protractor/node_modules/selenium-webdriver/lib/promise.js:2868:14)
    at TaskQueue.executeNext_ (/Users/cnishina/protractor/node_modules/selenium-webdriver/lib/promise.js:2851:21)
    at /Users/cnishina/protractor/node_modules/selenium-webdriver/lib/promise.js:2730:27
    at /Users/cnishina/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
    at process._tickCallback (node.js:368:9)
[11:19:33] E/launcher - Process exited with error code 1
@pedrro
Copy link
Contributor

pedrro commented Apr 26, 2016

Hi @cnishina, how can I test it on my local environment? Because the build is not broken... Should I update it to be merged or you gonna work on this issue? I can take a look also.

@cnishina
Copy link
Member Author

@pedrro To run this test:

  • webdriver-manager start
  • from the protractor directory: npm start
  • then the test is node scripts/attachSession.js.

Attach session:

  • The script launches a session
  • Protractor takes the session in via command line and launches a really simple test against the session
  • The script then closes the session

To run the full suite, simply run npm test...

If you want to take a stab at this, go for it. 👍

@pedrro
Copy link
Contributor

pedrro commented Apr 26, 2016

So, I made a quick test here and have some update:

I made the rollback on the version of selenium-webdriver on package.json to version 2.52.0 and keep the update on version of selenium and iedriver inside config.json and the tests are running fine again.

So, I have a question, have some relationship between the version of selenium-webdriver@package.json and the version of selenium@config.json? If the answer is no, I can update my PR #3172 to just consider the versions inside config.json and also we can create a issue on selenium repository to investigate it.

What do you think? :D

@cnishina
Copy link
Member Author

The selenium-webdriver in the package.json is the node api that helps make client calls. The selenium in the config.json is for the selenium server. If you leave the package.json version to 2.52.0, the PR is easy and can be approved.

@pedrro
Copy link
Contributor

pedrro commented Apr 26, 2016

@cnishina Sure, I'll do that in some minutes. 👍

@juliemr
Copy link
Member

juliemr commented Apr 26, 2016

@cnishina https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/CHANGES.md mentions some changes to the error type thrown when the session is invalid, possibly related.

@cnishina
Copy link
Member Author

@juliemr Unfortunately, that was our fix for capabilities. This is something different.

@cnishina
Copy link
Member Author

cnishina commented Apr 26, 2016

We should wait for 2.53.2+ to fix capabilities internet explorer nativeEvents=false. #3058

@cnishina
Copy link
Member Author

In the protractor constructor, this.driver.getCapabilities() for some reason does not exist. Since webdriver has a session promise, modifying that line:

this.driver.getSession().then((session: webdriver.Session) => {

Where session object looks like:

{ applicationCacheEnabled: true,
  rotatable: false,
  handlesAlerts: true,
  databaseEnabled: true,
  version: '45.0',
  platform: 'MAC',
  nativeEvents: false,
  acceptSslCerts: true,
  'webdriver.remote.sessionid': 'd5cefd49-8dec-4e6d-b910-1eb741bc04da',
  webStorageEnabled: true,
  locationContextEnabled: true,
  browserName: 'firefox',
  takesScreenshot: true,
  javascriptEnabled: true,
  cssSelectorsEnabled: true }

It does not look like there is a method called getCapabilities on the session either. @juliemr I might need some help on this one.

@cnishina
Copy link
Member Author

SeleniumHQ/selenium#2017

@cnishina
Copy link
Member Author

The issue was fixed with SeleniumHQ/selenium@a368fca

We should skip 2.53.1 and wait for v2.53.2+.

@cnishina
Copy link
Member Author

Selenium webdriver 2.53.2 is out! #3167

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants