Frame

Playwright\Frame\FrameInterface

Methods

locator()

LocatorInterface

Create a locator within this frame.

function locator(string $selector): LocatorInterface

getByAltText()

LocatorInterface
function getByAltText(string $text, array $options = []): LocatorInterface

getByLabel()

LocatorInterface
function getByLabel(string $text, array $options = []): LocatorInterface

getByPlaceholder()

LocatorInterface
function getByPlaceholder(string $text, array $options = []): LocatorInterface

getByRole()

LocatorInterface
function getByRole(string $role, array $options = []): LocatorInterface

getByTestId()

LocatorInterface
function getByTestId(string $testId): LocatorInterface

getByText()

LocatorInterface
function getByText(string $text, array $options = []): LocatorInterface

getByTitle()

LocatorInterface
function getByTitle(string $text, array $options = []): LocatorInterface

frameLocator()

FrameLocatorInterface

Create a nested frame locator from this frame.

function frameLocator(string $selector): FrameLocatorInterface

owner()

LocatorInterface

Get locator for the frame element itself (the <iframe> owner).

function owner(): LocatorInterface

content()

string

The serialized HTML of the frame's own document, doctype included. Scoped to this frame, not to the page that embeds it.

function content(): string

goto()

?ResponseInterface
function goto(string $url, array|GotoOptions $options = []): ?ResponseInterface

setContent()

self
function setContent(string $html, array|SetContentOptions $options = []): self

waitForFunction()

self
function waitForFunction(string $pageFunction, mixed $arg = null, array|WaitForFunctionOptions $options = []): self

waitForURL()

self
function waitForURL(string $url, array|WaitForUrlOptions $options = []): self

waitForNavigation()

?ResponseInterface
function waitForNavigation(array|WaitForNavigationOptions $options = []): ?ResponseInterface

dragAndDrop()

self
function dragAndDrop(string $source, string $target, array|DragAndDropOptions $options = []): self

addScriptTag()

self
function addScriptTag(array|ScriptTagOptions $options = []): self

addStyleTag()

self
function addStyleTag(array|StyleTagOptions $options = []): self

evaluate()

mixed

Runs the expression in this frame's JavaScript context. The frame has its own global scope: what the page or a sibling frame defined is not reachable here.

function evaluate(string $expression, mixed $arg = null): mixed

evaluateHandle()

JSHandleInterface

Returns a handle to the result instead of a serialized copy, so a DOM node or a live object survives the round trip. Dispose the handle once done with it, otherwise it pins its target until the page closes.

function evaluateHandle(string $expression, mixed $arg = null): JSHandleInterface

frameElement()

JSHandleInterface

A handle to the <iframe> element embedding this frame, resolved from the parent document. The main frame has no embedding element and reports an error instead.

function frameElement(): JSHandleInterface

page()

PageInterface

The page this frame belongs to, main frame and nested frames alike.

function page(): PageInterface

name()

string

The frame's name attribute.

function name(): string

title()

string

The frame document title.

function title(): string

url()

string

The current URL loaded in this frame.

function url(): string

isDetached()

bool

Whether the frame is detached from the DOM.

function isDetached(): bool

waitForLoadState()

self

Wait for a particular load state in this frame.

function waitForLoadState(string $state = 'load', array $options = []): self

parentFrame()

?FrameInterface

Get the parent frame, if any.

function parentFrame(): ?FrameInterface

childFrames()

array

Get the child frames of this frame.

function childFrames(): array

__toString()

string
function __toString(): string