public interface Emulation
Modifier and Type | Method and Description |
---|---|
Boolean |
canEmulate()
Tells whether emulation is supported.
|
void |
clearDeviceMetricsOverride()
Clears the overriden device metrics.
|
void |
clearGeolocationOverride()
Clears the overriden Geolocation Position and Error.
|
void |
resetPageScaleFactor()
Requests that page scale factor is reset to initial values.
|
void |
setCPUThrottlingRate(Double rate)
Enables CPU throttling to emulate slow CPUs.
|
void |
setDefaultBackgroundColorOverride()
Sets or clears an override of the default background color of the frame.
|
void |
setDefaultBackgroundColorOverride(RGBA color)
Sets or clears an override of the default background color of the frame.
|
void |
setDeviceMetricsOverride(Integer width,
Integer height,
Double deviceScaleFactor,
Boolean mobile)
Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).
|
void |
setDeviceMetricsOverride(Integer width,
Integer height,
Double deviceScaleFactor,
Boolean mobile,
Double scale,
Integer screenWidth,
Integer screenHeight,
Integer positionX,
Integer positionY,
Boolean dontSetVisibleSize,
ScreenOrientation screenOrientation)
Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).
|
void |
setEmulatedMedia(String media)
Emulates the given media for CSS media queries.
|
void |
setGeolocationOverride()
Overrides the Geolocation Position or Error.
|
void |
setGeolocationOverride(Double latitude,
Double longitude,
Double accuracy)
Overrides the Geolocation Position or Error.
|
void |
setPageScaleFactor(Double pageScaleFactor)
Sets a specified page scale factor.
|
void |
setScriptExecutionDisabled(Boolean value)
Switches script execution in the page.
|
void |
setTouchEmulationEnabled(Boolean enabled)
Toggles mouse event-based touch event emulation.
|
void |
setTouchEmulationEnabled(Boolean enabled,
Platform configuration)
Toggles mouse event-based touch event emulation.
|
void |
setVirtualTimePolicy(VirtualTimePolicy policy)
Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy.
|
void |
setVirtualTimePolicy(VirtualTimePolicy policy,
Integer budget)
Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy.
|
void |
setVisibleSize(Integer width,
Integer height)
Resizes the frame/viewport of the page.
|
void setDeviceMetricsOverride(Integer width, Integer height, Double deviceScaleFactor, Boolean mobile, Double scale, Integer screenWidth, Integer screenHeight, Integer positionX, Integer positionY, Boolean dontSetVisibleSize, ScreenOrientation screenOrientation)
width
- Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.height
- Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.deviceScaleFactor
- Overriding device scale factor value. 0 disables the override.mobile
- Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.scale
- Scale to apply to resulting view image. Ignored in |fitWindow| mode.screenWidth
- Overriding screen width value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.screenHeight
- Overriding screen height value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.positionX
- Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.positionY
- Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.dontSetVisibleSize
- Do not set visible view size, rely upon explicit setVisibleSize call.screenOrientation
- Screen orientation override.void clearDeviceMetricsOverride()
void resetPageScaleFactor()
void setPageScaleFactor(Double pageScaleFactor)
pageScaleFactor
- Page scale factor.void setVisibleSize(Integer width, Integer height)
width
- Frame width (DIP).height
- Frame height (DIP).void setScriptExecutionDisabled(Boolean value)
value
- Whether script execution should be disabled in the page.void setGeolocationOverride(Double latitude, Double longitude, Double accuracy)
latitude
- Mock latitudelongitude
- Mock longitudeaccuracy
- Mock accuracyvoid clearGeolocationOverride()
void setTouchEmulationEnabled(Boolean enabled, Platform configuration)
enabled
- Whether the touch event emulation should be enabled.configuration
- Touch/gesture events configuration. Default: current platform.void setEmulatedMedia(String media)
media
- Media type to emulate. Empty string disables the override.void setCPUThrottlingRate(Double rate)
rate
- Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).Boolean canEmulate()
void setVirtualTimePolicy(VirtualTimePolicy policy, Integer budget)
budget
- If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.void setDefaultBackgroundColorOverride(RGBA color)
color
- RGBA of the default background color. If not specified, any existing override will be cleared.void setDeviceMetricsOverride(Integer width, Integer height, Double deviceScaleFactor, Boolean mobile)
width
- Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.height
- Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.deviceScaleFactor
- Overriding device scale factor value. 0 disables the override.mobile
- Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.void setGeolocationOverride()
void setTouchEmulationEnabled(Boolean enabled)
enabled
- Whether the touch event emulation should be enabled.void setVirtualTimePolicy(VirtualTimePolicy policy)
void setDefaultBackgroundColorOverride()
Copyright © 2017 WebFolder OÜ. All rights reserved.