Override Device Mode (overrides device dimensions).

setDeviceDimensions() is only available when using Chrome or Edge drivers.

Usage

.setDeviceDimensions({width, height, deviceScaleFactor, mobile}, [callback])

Parameters

Name Type description
metrics object
callback
Optional
function

Optional callback function to be called when the command finishes.

Example

 this.demoTest = function (browser) {
   browser
     .setDeviceDimensions({
       width: 400,
       height: 600,
       deviceScaleFactor: 50,
       mobile: true
       })
     .navigateTo('https://www.google.com');
 };

Recommended content