Skip to content

[js] webdriver.attachToSession creates an object rather than a session instance #2017

@cnishina

Description

@cnishina

Issue: BUG
This used to work in protractor with selenium-webdriver: 2.52.0
Issue spotted when trying to upgrade to selenium-webdriver: 2.53.1

To help with describing this issue, I logged the session in the webdriver constructor:

  constructor(session, executor, opt_flow) {
    /** @private {!promise.Promise<!Session>} */
    this.session_ = promise.fulfilled(session);;
    this.session_.then(function(mySession) {
      console.log('session:', mySession);
    });

Expected:

Creating a session using builder.build() method:

  • calls create session
  • logging to console returns a session instance

log shown below of type Session:

session Session {
  id_: '8ff2e2ef-c8c3-4a02-9bc7-ab0e621e23bf',
  caps_: 
   Capabilities {
     'applicationCacheEnabled' => false,
     'rotatable' => false,
     'mobileEmulationEnabled' => false,
     'chrome' => { chromedriverVersion: '2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a)',
     userDataDir: '/tmp/.com.google.Chrome.ymPpDp' },
     'takesHeapSnapshot' => true,
     'databaseEnabled' => false,
     'handlesAlerts' => true,
     'hasTouchScreen' => false,
     'version' => '50.0.2661.86',
     'platform' => 'LINUX',
     'browserConnectionEnabled' => false,
     'nativeEvents' => true,
     'acceptSslCerts' => true,
     'webdriver.remote.sessionid' => '8ff2e2ef-c8c3-4a02-9bc7-ab0e621e23bf',
     'locationContextEnabled' => true,
     'webStorageEnabled' => true,
     'browserName' => 'chrome',
     'takesScreenshot' => true,
     'javascriptEnabled' => true,
     'cssSelectorsEnabled' => true } }

Actual with attachToSession:

  • when using webdriver attachToSesssion, the returned session is just a simple object:
session { applicationCacheEnabled: true,
  rotatable: false,
  handlesAlerts: true,
  databaseEnabled: true,
  version: '46.0',
  platform: 'LINUX',
  nativeEvents: false,
  acceptSslCerts: true,
  'webdriver.remote.sessionid': '4e335a81-aa3a-4a1f-9181-67537cc5fc33',
  webStorageEnabled: true,
  locationContextEnabled: true,
  browserName: 'firefox',
  takesScreenshot: true,
  javascriptEnabled: true,
  cssSelectorsEnabled: true }

Where this is being used: https://github.com/angular/protractor/blob/master/lib/driverProviders/attachSession.ts#L37

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions