UNPKG

webdriverio

Version:

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

29 lines (21 loc) 818 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = setWindowSize; var _utils = require("../../utils"); function setWindowSize(width, height) { const minWindowSize = 0; const maxWindowSize = 2147483647; if (typeof width !== 'number' || typeof height !== 'number') { throw new Error('setWindowSize expects width and height of type number'); } if (width < minWindowSize || width > maxWindowSize || height < minWindowSize || height > maxWindowSize) { throw new Error('setWindowSize expects width and height to be a number in the 0 to 2^31 − 1 range'); } const browser = (0, _utils.getBrowserObject)(this); if (!browser.isW3C) { return browser._setWindowSize(width, height); } return browser.setWindowRect(null, null, width, height); }