New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This driver instance does not have a valid session ID - (did you call WebDriver.quit()?) and may no longer be used. #4817

Open
harin10 opened this Issue May 16, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@harin10

harin10 commented May 16, 2018

My code runs like this : ActivationData - array of test data
I want to run the describe for each array element and then I wanna to clear the catch and cookies (restart ) then I need to run the same describe for second array element.

I Have used restartBrowserBetweenTests: true, and also I tried to restart in afterEach block. but I still see the below error for each array element that means if I have an array of size 3 then I see the 3 same errors.

If I remove the restartBrowserBetweenTests or afterEach/beforeEach block. there wont be any errors.
and I have also made this config browser.ignoreSynchronization = true;

drive(activationData, function (inputActivationData) {
describe('Drive Spec', function () {

        beforeEach(function () {
            console.log("restarting");
            browser.restart();
            console.log("complete");
        });
        
        it('Copying activation test data to session', function (done) {
            sessionData.netten.esnPartNumber = inputActivationData.PartNumber;
            sessionData.netten.simPartNumber = inputActivationData.SIM;
            sessionData.netten.zip = inputActivationData.ZipCode;
            sessionData.netten.pinPartNumber = inputActivationData.PIN;
            console.log(sessionData.netten.esnPartNumber);
            console.log(sessionData.netten.simPartNumber);
            console.log(sessionData.netten.zip);
            console.log(sessionData.netten.pinPartNumber);
            done();
        });
        FlowUtil.run('LANDINGPAGE_INTI_SCENARIO');
    
    }).result.data = inputActivationData;

});

error_code.txt

@simonua

This comment has been minimized.

Show comment
Hide comment
@simonua

simonua May 17, 2018

Contributor

@harin10, I don't immediately see the same scenario in your sample as I have seen in our code when it failed for us with restarting browsers in between tests, but what I can say is that this same error for us was resolved by ensuring that PageObjects, etc. were properly re-initialized before each test. Our first test always passed, but all subsequent tests failed because we used previously-initialized objects with elements that were acquired for the first browser instance, which then got intentionally discarded after the first test completed. In other words, make sure you re-acquire each element you need for your test.

Hth,

Simon

Contributor

simonua commented May 17, 2018

@harin10, I don't immediately see the same scenario in your sample as I have seen in our code when it failed for us with restarting browsers in between tests, but what I can say is that this same error for us was resolved by ensuring that PageObjects, etc. were properly re-initialized before each test. Our first test always passed, but all subsequent tests failed because we used previously-initialized objects with elements that were acquired for the first browser instance, which then got intentionally discarded after the first test completed. In other words, make sure you re-acquire each element you need for your test.

Hth,

Simon

@vambcool

This comment has been minimized.

Show comment
Hide comment
@vambcool

vambcool Jul 16, 2018

I am also having the same issue. My first test is running successfully, there after all other tests were failing with the same error.
@simonua

vambcool commented Jul 16, 2018

I am also having the same issue. My first test is running successfully, there after all other tests were failing with the same error.
@simonua

@sdjnaik

This comment has been minimized.

Show comment
Hide comment
@sdjnaik

sdjnaik Aug 16, 2018

Any update on this issue?

Setting restartBrowserBetweenTests to true or false doesn't seem to be helping while running multiple test cases together. ONly first test case is running and later all other test cases are failing with error: " NoSuchSessionError: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used."

Protractor version: 5.3.2

sdjnaik commented Aug 16, 2018

Any update on this issue?

Setting restartBrowserBetweenTests to true or false doesn't seem to be helping while running multiple test cases together. ONly first test case is running and later all other test cases are failing with error: " NoSuchSessionError: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used."

Protractor version: 5.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment