Frame
Playwright\Frame\FrameInterface
Methods
locator()
LocatorInterfaceCreate a locator within this frame.
function locator(string $selector): LocatorInterface
getByAltText()
LocatorInterfacefunction getByAltText(string $text, array $options = []): LocatorInterface
getByLabel()
LocatorInterfacefunction getByLabel(string $text, array $options = []): LocatorInterface
getByPlaceholder()
LocatorInterfacefunction getByPlaceholder(string $text, array $options = []): LocatorInterface
getByRole()
LocatorInterfacefunction getByRole(string $role, array $options = []): LocatorInterface
getByTestId()
LocatorInterfacefunction getByTestId(string $testId): LocatorInterface
getByText()
LocatorInterfacefunction getByText(string $text, array $options = []): LocatorInterface
getByTitle()
LocatorInterfacefunction getByTitle(string $text, array $options = []): LocatorInterface
frameLocator()
FrameLocatorInterfaceCreate a nested frame locator from this frame.
function frameLocator(string $selector): FrameLocatorInterface
owner()
LocatorInterfaceGet locator for the frame element itself (the <iframe> owner).
function owner(): LocatorInterface
content()
stringThe 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()
?ResponseInterfacefunction goto(string $url, array|GotoOptions $options = []): ?ResponseInterface
setContent()
selffunction setContent(string $html, array|SetContentOptions $options = []): self
waitForFunction()
selffunction waitForFunction(string $pageFunction, mixed $arg = null, array|WaitForFunctionOptions $options = []): self
waitForURL()
selffunction waitForURL(string $url, array|WaitForUrlOptions $options = []): self
waitForNavigation()
?ResponseInterfacefunction waitForNavigation(array|WaitForNavigationOptions $options = []): ?ResponseInterface
dragAndDrop()
selffunction dragAndDrop(string $source, string $target, array|DragAndDropOptions $options = []): self
addScriptTag()
selffunction addScriptTag(array|ScriptTagOptions $options = []): self
addStyleTag()
selffunction addStyleTag(array|StyleTagOptions $options = []): self
evaluate()
mixedRuns 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()
JSHandleInterfaceReturns 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()
JSHandleInterfaceA 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()
PageInterfaceThe page this frame belongs to, main frame and nested frames alike.
function page(): PageInterface
name()
stringThe frame's name attribute.
function name(): string
title()
stringThe frame document title.
function title(): string
url()
stringThe current URL loaded in this frame.
function url(): string
isDetached()
boolWhether the frame is detached from the DOM.
function isDetached(): bool
waitForLoadState()
selfWait for a particular load state in this frame.
function waitForLoadState(string $state = 'load', array $options = []): self
parentFrame()
?FrameInterfaceGet the parent frame, if any.
function parentFrame(): ?FrameInterface
childFrames()
arrayGet the child frames of this frame.
function childFrames(): array
__toString()
stringfunction __toString(): string