getWindowSize
Returns browser window size.
Usage
browser.getWindowSize()
Example
- Asynchronous Mode
- Synchronous Mode
getWindowSize.js
it('should return browser window size', async () => {
const windowSize = await browser.getWindowSize();
console.log(windowSize);
// outputs `{ width: 1280, height: 767 }`
});
getWindowSize.js
it('should return browser window size', () => {
const windowSize = browser.getWindowSize();
console.log(windowSize);
// outputs `{ width: 1280, height: 767 }`
});
caution
Synchronous Mode will depcrecated with Node.js v16. With an update to the underlying Chromium version it became technically impossible to provide the same synchronous behavior. We recommend to start transition to asynchronous command execution. For more information, see our RFC.