BrowserSession

Playwright\Symfony\Client\BrowserSessionInterface

An isolated browser context and page managed by a browser registry.

$ composer require playwright-php/playwright-symfony

Methods

getContext()

?BrowserContextInterface

Returns the isolated browser context, or null after the session is closed.

function getContext(): ?BrowserContextInterface

getPage()

?PageInterface

Returns the session's page, or null after the session is closed.

function getPage(): ?PageInterface

setupRouting()

void

Registers a request handler on the session's page.

function setupRouting(callable $routeHandler): void

close()

void

Closes the isolated browser context. Use BrowserRegistry::closeSession() for sessions managed by a registry so it can release its reference to the session immediately.

function close(): void