UNPKG

webdriverio

Version:

Next-gen browser and mobile automation test framework for Node.js

29 lines (23 loc) 816 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = newWindow; var _newWindow = _interopRequireDefault(require("../../scripts/newWindow")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } async function newWindow(url, { windowName = 'New Window', windowFeatures = '' } = {}) { if (typeof url !== 'string') { throw new Error('number or type of arguments don\'t agree with newWindow command'); } if (this.isMobile) { throw new Error('newWindow command is not supported on mobile platforms'); } await this.execute(_newWindow.default, url, windowName, windowFeatures); const tabs = await this.getWindowHandles(); const newTab = tabs.pop(); await this.switchToWindow(newTab); return newTab; }