Device

Playwright\Device\Device

$ composer require playwright-php/devices

Methods

__construct()

function __construct( private readonly string $name, private readonly string $userAgent, private readonly string $defaultBrowserType, private readonly ?array $screen, private readonly array $viewport, private readonly ?array $viewportLandscape, private readonly float $deviceScaleFactor, private readonly bool $isMobile = true, private readonly bool $hasTouch = true, )

portrait()

self
function portrait(): self

landscape()

self
function landscape(): self

getViewport()

?array
function getViewport(): ?array

getDefaultBrowserType()

string
function getDefaultBrowserType(): string

getDeviceScaleFactor()

float
function getDeviceScaleFactor(): float

getName()

string
function getName(): string

getScreen()

?array
function getScreen(): ?array

getUserAgent()

string
function getUserAgent(): string

hasTouch()

bool
function hasTouch(): bool

isMobile()

bool
function isMobile(): bool

toArray()

array

Returns the device descriptor as an array.

function toArray(): array