I am using protractor-cucumber-framework, but when I try to restart I get
This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.
I tried both in cucumber and default protractor jasmine framework:
I am just calling
await browser.restart()
From beforeEach or before hook
My Spec:
'use strict';
let stage1 = require('../pageobjects/stage1.js');
describe('Validate stage 1 and 2 behaviour', function () {
beforeEach(async function () {
await browser.restart();
await browser.waitForAngularEnabled(false);
stage1 = new Object(require('../pageobjects/stage1.js'));
});
it('Validate that error message in all fields given uploaded {Regression} {Smoke} {Sanity}', async function () {
await stage1.goto()
await stage1.sendValue('hi')
});
it('Validate that s message in all fields given uploaded {Regression} {Smoke} {Sanity}', async function () {
await stage1.goto()
await stage1.sendValue('hi')
});
});
My page Object:
'use strict';
let fileListActions = require('../commons/fileListActions');
module.exports = {
elements: {
textField: element(by.css('[name="q"]')),
},
goto: async function() {
let elements= this.elements;
await browser.get('https://www.google.com/');
},
sendValue: async function(item,value) {
let elements= this.elements;
await elements['textField'].sendKeys('Hi')
},
};
My config:
'use strict';
exports.config = {
onPrepare: function () {
browser.waitForAngularEnabled(false);
},
restartBrowserBetweenTests: true,
multiCapabilities: [{
browserName: 'chrome',
},
],
specs: ['testsuites/1.js'],
jasmineNodeOpts: {
showColors: true,
realtimeFailure: true
},
SELENIUM_PROMISE_MANAGER: false,
};