StorageState

Playwright\Browser\StorageState

Storage state container for cookies and localStorage data.

Methods

__construct()

function __construct( public array $cookies = [], public array $origins = [], )

fromJson()

self

Create a StorageState from a JSON string.

function fromJson(string $json): self

fromFile()

self

Load StorageState from a JSON file.

function fromFile(string $filePath): self

fromArray()

self
function fromArray(array $data): self

toJson()

string
function toJson(int $flags = 0): string

toArray()

array
function toArray(): array

saveToFile()

void
function saveToFile(string $filePath): void

isEmpty()

bool
function isEmpty(): bool

getCookieCount()

int
function getCookieCount(): int

getOriginCount()

int
function getOriginCount(): int

getCookiesForDomain()

array
function getCookiesForDomain(string $domain): array

getLocalStorageForOrigin()

array
function getLocalStorageForOrigin(string $origin): array