Table of Contents

Class SetDeviceMetricsOverrideCommandSettings

Namespace
OpenQA.Selenium.DevTools.V148.Emulation
Assembly
Selenium.WebDriver.dll

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).

public sealed class SetDeviceMetricsOverrideCommandSettings : ICommand
Inheritance
SetDeviceMetricsOverrideCommandSettings
Implements
Inherited Members

Properties

CommandName

Gets the name of the command.

[JsonIgnore]
public string CommandName { get; }

Property Value

string

DevicePosture

If set, the posture of a foldable device. If not set the posture is set to continuous. Deprecated, use Emulation.setDevicePostureOverride.

[JsonPropertyName("devicePosture")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public DevicePosture? DevicePosture { get; set; }

Property Value

DevicePosture

DeviceScaleFactor

Overriding device scale factor value. 0 disables the override.

[JsonPropertyName("deviceScaleFactor")]
public double DeviceScaleFactor { get; set; }

Property Value

double

DisplayFeature

If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off. Deprecated, use Emulation.setDisplayFeaturesOverride.

[JsonPropertyName("displayFeature")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public DisplayFeature? DisplayFeature { get; set; }

Property Value

DisplayFeature

DontSetVisibleSize

Do not set visible view size, rely upon explicit setVisibleSize call.

[JsonPropertyName("dontSetVisibleSize")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? DontSetVisibleSize { get; set; }

Property Value

bool?

Height

Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.

[JsonPropertyName("height")]
public long Height { get; set; }

Property Value

long

Mobile

Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.

[JsonPropertyName("mobile")]
public bool Mobile { get; set; }

Property Value

bool

PositionX

Overriding view X position on screen in pixels (minimum 0, maximum 10000000).

[JsonPropertyName("positionX")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public long? PositionX { get; set; }

Property Value

long?

PositionY

Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).

[JsonPropertyName("positionY")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public long? PositionY { get; set; }

Property Value

long?

Scale

Scale to apply to resulting view image.

[JsonPropertyName("scale")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double? Scale { get; set; }

Property Value

double?

ScreenHeight

Overriding screen height value in pixels (minimum 0, maximum 10000000).

[JsonPropertyName("screenHeight")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public long? ScreenHeight { get; set; }

Property Value

long?

ScreenOrientation

Screen orientation override.

[JsonPropertyName("screenOrientation")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public ScreenOrientation? ScreenOrientation { get; set; }

Property Value

ScreenOrientation

ScreenOrientationLockEmulation

If set to true, enables screen orientation lock emulation, which intercepts screen.orientation.lock() calls from the page and reports orientation changes via screenOrientationLockChanged events. This is useful for emulating mobile device orientation lock behavior in responsive design mode.

[JsonPropertyName("screenOrientationLockEmulation")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? ScreenOrientationLockEmulation { get; set; }

Property Value

bool?

ScreenWidth

Overriding screen width value in pixels (minimum 0, maximum 10000000).

[JsonPropertyName("screenWidth")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public long? ScreenWidth { get; set; }

Property Value

long?

ScrollbarType

Scrollbar type. Default: default.

[JsonPropertyName("scrollbarType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? ScrollbarType { get; set; }

Property Value

string

Viewport

If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.

[JsonPropertyName("viewport")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Viewport? Viewport { get; set; }

Property Value

Viewport

Width

Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.

[JsonPropertyName("width")]
public long Width { get; set; }

Property Value

long