Skip to main content
Go to Latest
class Frame
import { Frame } from "https://deno.land/x/puppeteer@14.1.1/vendor/puppeteer-core/puppeteer/common/FrameManager.d.ts";

At every point of time, page exposes its current frame tree via the Page.mainFrame | page.mainFrame and Frame.childFrames | frame.childFrames methods.

Constructors

new
Frame(
frameManager: FrameManager,
parentFrame: Frame | null,
frameId: string,
client: CDPSession,
)

Properties

private
_detached
private
optional
_parentFrame
private
_url
_childFrames: Set<Frame>
_client: CDPSession
_frameManager: FrameManager
_hasStartedLoading: boolean
_id: string
_lifecycleEvents: Set<string>
_loaderId: string
_mainWorld: DOMWorld
optional
_name: string
_secondaryWorld: DOMWorld

Methods

_detach(): void
_navigated(framePayload: Protocol.Page.Frame): void
_navigatedWithinDocument(url: string): void
_onLifecycleEvent(loaderId: string, name: string): void
_updateClient(client: CDPSession): void
$<T extends any = any>(selector: string): Promise<ElementHandle<T> | null>

This method queries the frame for the given selector.

$$<T extends any = any>(selector: string): Promise<Array<ElementHandle<T>>>

This runs document.querySelectorAll in the frame and returns the result.

$$eval<ReturnType>(
selector: string,
pageFunction: (elements: any[], ...args: unknown[]) => ReturnType | Promise<ReturnType>,
): Promise<WrapElementHandle<ReturnType>>
$eval<ReturnType>(
selector: string,
pageFunction: (element: any, ...args: unknown[]) => ReturnType | Promise<ReturnType>,
): Promise<WrapElementHandle<ReturnType>>
$x(expression: string): Promise<ElementHandle[]>

This method evaluates the given XPath expression and returns the results.

Adds a <script> tag into the page with the desired url or content.

Adds a <link rel="stylesheet"> tag into the page with the desired url or a <style type="text/css"> tag with the content.

click(selector: string, options?: { delay?: number; button?: MouseButton; clickCount?: number; }): Promise<void>

This method clicks the first element found that matches selector.

content(): Promise<string>
evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>
evaluateHandle<HandlerType extends JSHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandlerType>
focus(selector: string): Promise<void>

This method fetches an element with selector and focuses it.

goto(url: string, options?: { referer?: string; timeout?: number; waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; }): Promise<HTTPResponse | null>
hover(selector: string): Promise<void>

This method fetches an element with selector, scrolls it into view if needed, and then uses Page.mouse to hover over the center of the element.

isDetached(): boolean
isOOPFrame(): boolean
name(): string
parentFrame(): Frame | null
select(selector: string, ...values: string[]): Promise<string[]>

Triggers a change and input event once all the provided options have been selected.

setContent(html: string, options?: { timeout?: number; waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; }): Promise<void>

Set the content of the frame.

tap(selector: string): Promise<void>

This method fetches an element with selector, scrolls it into view if needed, and then uses Page.touchscreen to tap in the center of the element.

title(): Promise<string>
type(
selector: string,
text: string,
options?: { delay: number; },
): Promise<void>

Sends a keydown, keypress/input, and keyup event for each character in the text.

url(): string
deprecated
waitFor(
selectorOrFunctionOrTimeout: string | number | Function,
options?: Record<string, unknown>,
): Promise<JSHandle | null>
waitForFunction(
pageFunction: Function | string,
): Promise<JSHandle>
waitForNavigation(options?: { timeout?: number; waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]; }): Promise<HTTPResponse | null>
waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<ElementHandle | null>
waitForTimeout(milliseconds: number): Promise<void>

Causes your script to wait for the given number of milliseconds.

waitForXPath(xpath: string, options?: WaitForSelectorOptions): Promise<ElementHandle | null>