.setDeviceDimensions() Suggest edits
Since: 2.2.0Override device mode/dimensions. Call without any arguments to reset the device dimensions back to original.
Usage
.setDeviceDimensions({width, height, deviceScaleFactor, mobile}, [callback])
Example
describe('modify device dimensions', function() {
it('modifies the device dimensions and then resets it', function() {
browser
.setDeviceDimensions({
width: 400,
height: 600,
deviceScaleFactor: 50,
mobile: true
})
.navigateTo('https://www.google.com')
.pause(1000)
.setDeviceDimensions() // resets the device dimensions
.navigateTo('https://www.google.com')
.pause(1000);
});
});
Parameters
Name | Type | description |
---|---|---|
metrics Optional |
object | Device metrics to set. Metric defaults to original if not set. |
callback Optional |
function | Callback function to be called when the command finishes. |