Added "restartOnAuthFail" as an option (#112)

- When true, the sessions passed is discarded when reinitialized.
This commit is contained in:
Steven L
2020-03-23 10:52:46 +11:00
committed by GitHub
parent ec1a80dfb4
commit d08b343815

View File

@@ -75,7 +75,11 @@ class Client extends EventEmitter {
*/
this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?');
browser.close();
if (this.options.restartOnAuthFail) {
// session restore failed so try again but without session to force new authentication
this.options.session = null;
this.initialize(this.options);
}
return;
}