PlaywrightDriver

Playwright\Mink\Driver\PlaywrightDriver

Playwright-powered driver for Behat/Mink.

$ composer require playwright-php/playwright-mink

Methods

__construct()

function __construct( private readonly string $browserType = 'chromium', private readonly bool $headless = true, private readonly array $launchOptions = [], private readonly array $contextOptions = [], )

start()

void
function start(): void

isStarted()

bool
function isStarted(): bool

stop()

void
function stop(): void

reset()

void
function reset(): void

visit()

void
function visit(string $url): void

getCurrentUrl()

string
function getCurrentUrl(): string

reload()

void
function reload(): void

forward()

void
function forward(): void

back()

void
function back(): void

setBasicAuth()

void
function setBasicAuth($user, string $password): void

switchToWindow()

void
function switchToWindow(?string $name = null): void

switchToIFrame()

void
function switchToIFrame(?string $name = null): void

setRequestHeader()

void
function setRequestHeader(string $name, string $value): void

getResponseHeaders()

array
function getResponseHeaders(): array

setCookie()

void
function setCookie(string $name, ?string $value = null): void

getCookie()

?string
function getCookie(string $name): ?string

getStatusCode()

int
function getStatusCode(): int

getContent()

string
function getContent(): string

getScreenshot()

string
function getScreenshot(): string

getWindowNames()

array
function getWindowNames(): array

getWindowName()

string
function getWindowName(): string

getTagName()

string
function getTagName(string $xpath): string

getText()

string
function getText(string $xpath): string

getHtml()

string
function getHtml(string $xpath): string

getOuterHtml()

string
function getOuterHtml(string $xpath): string

getAttribute()

?string
function getAttribute(string $xpath, string $name): ?string

getValue()

string|array|null
function getValue(string $xpath): string|array|null

setValue()

void

Set the value of a form element identified by XPath. Handles text, checkbox, radio, select, and file inputs.

function setValue(string $xpath, $value): void

check()

void
function check(string $xpath): void

uncheck()

void
function uncheck(string $xpath): void

isChecked()

bool
function isChecked(string $xpath): bool

selectOption()

void
function selectOption(string $xpath, string $value, bool $multiple = false): void

isSelected()

bool
function isSelected(string $xpath): bool

click()

void
function click(string $xpath): void

doubleClick()

void
function doubleClick(string $xpath): void

rightClick()

void
function rightClick(string $xpath): void

attachFile()

void
function attachFile(string $xpath, string $path): void

isVisible()

bool
function isVisible(string $xpath): bool

mouseOver()

void
function mouseOver(string $xpath): void

focus()

void
function focus(string $xpath): void

blur()

void
function blur(string $xpath): void

keyPress()

void
function keyPress(string $xpath, $char, ?string $modifier = null): void

keyDown()

void
function keyDown(string $xpath, $char, ?string $modifier = null): void

keyUp()

void
function keyUp(string $xpath, $char, ?string $modifier = null): void

dragTo()

void
function dragTo(string $sourceXpath, string $destinationXpath): void

executeScript()

void
function executeScript(string $script): void

evaluateScript()

mixed
function evaluateScript(string $script): mixed

wait()

bool
function wait(int $timeout, string $condition): bool

resizeWindow()

void
function resizeWindow(int $width, int $height, ?string $name = null): void

maximizeWindow()

void
function maximizeWindow(?string $name = null): void

submitForm()

void
function submitForm(string $xpath): void