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

This driver instance does not have a valid session ID after browser.restart() #3648

Closed
@romario333

Description

@romario333

Bug report

  • Node Version: 6.7.0
  • Protractor Version: 4.0.9
  • Browser(s): chromedriver_2.24
  • Operating System and Version OS X 10.11.6

Clone browser-restart-bug to reproduce the bug.

Similar issue has been reported here: #2001 (note that I still see the bug with the latest protractor).

I use protractor together with typescript. My test looks like this:

import {browser} from 'protractor';

describe('Test', () => {
  afterEach( () => {
    browser.restart();
  });

  it('Go to angular', () => {
    browser.get('https://angularjs.org/');
  });

  it('Go to angular-tutorial', () => {
    browser.get('https://docs.angularjs.org/tutorial');
  });
});

This fails with:

Failures:
1) Test Go to angular-tutorial
  Message:
    Failed: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.
  Stack:
    NoSuchSessionError: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.
        at WebDriverError (/Users/romario/tmp/browser-restart-bug/node_modules/selenium-webdriver/lib/error.js:27:5)
        at NoSuchSessionError (/Users/romario/tmp/browser-restart-bug/node_modules/selenium-webdriver/lib/error.js:170:5)
        at checkHasNotQuit (/Users/romario/tmp/browser-restart-bug/node_modules/selenium-webdriver/lib/webdriver.js:395:15)
        at Driver.schedule (/Users/romario/tmp/browser-restart-bug/node_modules/selenium-webdriver/lib/webdriver.js:356:5)
        at Navigation.to (/Users/romario/tmp/browser-restart-bug/node_modules/selenium-webdriver/lib/webdriver.js:1027:25)
        at Driver.get (/Users/romario/tmp/browser-restart-bug/node_modules/selenium-webdriver/lib/webdriver.js:795:28)
        at ProtractorBrowser.get (/Users/romario/tmp/browser-restart-bug/node_modules/protractor/built/browser.js:482:21)
        at Object.it (/Users/romario/tmp/browser-restart-bug/build/browser-restart-spec.js:11:30)
        at /Users/romario/tmp/browser-restart-bug/node_modules/jasminewd2/index.js:94:23
        at new ManagedPromise (/Users/romario/tmp/browser-restart-bug/node_modules/selenium-webdriver/lib/promise.js:1082:7)
    From: Task: Run it("Go to angular-tutorial") in control flow
        at Object.<anonymous> (/Users/romario/tmp/browser-restart-bug/node_modules/jasminewd2/index.js:79:14)
    From asynchronous test:
    Error
        at Suite.describe (/Users/romario/tmp/browser-restart-bug/build/browser-restart-spec.js:10:5)
        at Object.<anonymous> (/Users/romario/tmp/browser-restart-bug/build/browser-restart-spec.js:3:1)
        at Module._compile (module.js:556:32)
        at Object.Module._extensions..js (module.js:565:10)
        at Module.load (module.js:473:32)
        at tryModuleLoad (module.js:432:12)

If I don't import browser at the first line, test works (tsc fails, but test itself passes). If I use protractor.browser instead of browser test passes as well.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions