.getViewport()
Retrieves the width and height of the device viewport.
Usage
device.getViewport()
Returns
Promise (Object):
width(Number): Width of device viewpoint.height(Number): Height of device viewpoint.
Support
| Platform | Supported |
|---|---|
| iOS | Yes |
| Android | Yes |
| Web | Unknown |
Examples
Get viewport size of device (e.g. iPhone X):
const { device, expect } = require("appdriver");
(async () => {
const viewport = await device.getViewport();
return expect(viewport).toEqual({
width: 375,
height: 812
});
})();