* Creates a new WebDriver session. * * This function will always return a WebDriver instance. If there is an error * creating the session, such as the aforementioned SessionNotCreatedError, * the driver will have a rejected plain #getSession session promise. * This rejection wi
(executor, capabilities, onQuit = undefined)
| 727 | * @return {!WebDriver} The driver for the newly created session. |
| 728 | */ |
| 729 | static createSession(executor, capabilities, onQuit = undefined) { |
| 730 | let cmd = new command.Command(command.Name.NEW_SESSION) |
| 731 | |
| 732 | // For W3C remote ends. |
| 733 | cmd.setParameter('capabilities', { |
| 734 | firstMatch: [{}], |
| 735 | alwaysMatch: filterNonW3CCaps(capabilities), |
| 736 | }) |
| 737 | |
| 738 | let session = executeCommand(executor, cmd) |
| 739 | if (typeof onQuit === 'function') { |
| 740 | session = session.catch((err) => { |
| 741 | return Promise.resolve(onQuit.call(void 0)).then((_) => { |
| 742 | throw err |
| 743 | }) |
| 744 | }) |
| 745 | } |
| 746 | return new this(session, executor, onQuit) |
| 747 | } |
| 748 | |
| 749 | /** @override */ |
| 750 | async execute(command) { |
no test coverage detected