Skip to main content
Frame other methods for the Playwright driver.

frameElement

Returns the frame element associated with this frame.
Returns the ElementHandle for the <iframe> or <frame> tag for this frame. Returns null for the main frame.
Upstream docs
result
SerializedHandle
Return value
await frame.frameElement();

page

Returns the page containing this frame.
Returns the cached page reference passed at construction time.
Upstream docs
result
RemotePlaywrightPage
Return value
await frame.page();

name

Returns frame’s name attribute as specified in the tag.
If the name is empty, returns the id attribute instead. Returns empty string if both name and id are empty.
Upstream docs
result
string
Return value
await frame.name();

parentFrame

Parent frame, if any. Detached frames and main frames return null. Upstream docs
result
string | null
Return value
await frame.parentFrame();

childFrames

Returns child frames of this frame. Upstream docs
result
string[]
Return value
await frame.childFrames();

addScriptTag

Adds a <script> tag into the page with the desired url or content.
Returns the added tag when the script’s onload fires or when the script content was injected into frame.
Upstream docs
options
{ content?: string; path?: string; type?: string; url?: string }
result
SerializedHandle
Return value
await frame.addScriptTag();

addStyleTag

Adds a <style> tag into the page with the desired url or content.
Returns the added tag when the stylesheet’s onload fires or when the CSS content was injected into frame.
Upstream docs
options
{ content?: string; path?: string; url?: string }
result
SerializedHandle
Return value
await frame.addStyleTag();