import EmulationManager from 'chrome-remote-interface-extra/lib/EmulationManager.js'
EmulationManager
Constructor Summary
Public Constructor | ||
public |
constructor(client: Chrome | CRIConnection | CDPSession | Object) |
Member Summary
Private Members | ||
private |
_client: Chrome | CRIConnection | CDPSession | Object |
|
private |
What media type are we emulating |
|
private |
Are we emulating mobile? |
|
private |
Can we interact via touches |
|
private |
Is no script enabled |
|
private |
|
since chrome-remote-interface-extra |
Method Summary
Public Methods | ||
public |
async clearDeviceMetricsOverride(): Promise<void> Clears the overridden device metrics |
|
public |
async clearGeolocationOverride(): Promise<void> Clears the overridden Geolocation Position and Error |
|
public |
async emulateViewport(viewport: Viewport): Promise<boolean> |
|
public |
|
since chrome-remote-interface-extra |
public |
|
since chrome-remote-interface-extra |
public |
|
|
public |
async setDefaultBackgroundColorOverride(color: DOMRGBA): Promise<void> Sets or clears an override of the default background color of the frame. |
since chrome-remote-interface-extra |
public |
async setDeviceMetricsOverride(options: Object): Promise<void> Overrides the values of device screen dimensions
|
since chrome-remote-interface-extra |
public |
async setEmulatedMedia(media: string): Promise<void> Emulates the given media for CSS media queries |
since chrome-remote-interface-extra |
public |
async setGeolocation(options: {longitude: number, latitude: number, accuracy: number|undefined}) Overrides the Geolocation Position or Error. |
since chrome-remote-interface-extra |
public |
async setScriptExecutionDisabled(disabled: boolean): Promise<void> Switches script execution in the page. |
|
public |
async setTouchEmulationEnabled(enabled: boolean, maxTouchPoints: number): Promise<void> Enables touch on platforms which do not support them |
since chrome-remote-interface-extra |
Public Constructors
public constructor(client: Chrome | CRIConnection | CDPSession | Object) source
Params:
Name | Type | Attribute | Description |
client | Chrome | CRIConnection | CDPSession | Object |
Private Members
private _client: Chrome | CRIConnection | CDPSession | Object source
Public Methods
public async clearDeviceMetricsOverride(): Promise<void> source
Clears the overridden device metrics
public async clearGeolocationOverride(): Promise<void> source
Clears the overridden Geolocation Position and Error
public async emulateViewport(viewport: Viewport): Promise<boolean> source
Params:
Name | Type | Attribute | Description |
viewport | Viewport |
|
public async setDefaultBackgroundColorOverride(color: DOMRGBA): Promise<void> since chrome-remote-interface-extra source
Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.
Params:
Name | Type | Attribute | Description |
color | DOMRGBA |
|
RGBA of the default background color. If not specified, any existing override will be cleared |
public async setDeviceMetricsOverride(options: Object): Promise<void> since chrome-remote-interface-extra source
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).
Params:
Name | Type | Attribute | Description |
options | Object |
public async setEmulatedMedia(media: string): Promise<void> since chrome-remote-interface-extra source
Emulates the given media for CSS media queries
Params:
Name | Type | Attribute | Description |
media | string | Media type to emulate. Empty string disables the override |
public async setGeolocation(options: {longitude: number, latitude: number, accuracy: number|undefined}) since chrome-remote-interface-extra source
Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable
public async setScriptExecutionDisabled(disabled: boolean): Promise<void> source
Switches script execution in the page.
Params:
Name | Type | Attribute | Description |
disabled | boolean | Whether script execution should be disabled in the page |