PhantomJsCloud Automation API
    Preparing search index...

    Class Frame

    A frame of the page (the main frame or an iframe), as returned by Page.frames, Page.waitForFrame, ElementHandle.contentFrame and ElementHandle.frame.

    pjsc differences:

    • A Frame object is valid within one request. A call on a frame that has detached fails.
    • The synchronous members (url, name, parentFrame, childFrames, isDetached, detached, page, locator) read pjsc's copy of the frame tree, which is kept current as frames attach, detach and navigate.
    • Calls on the main frame wait until pjsc's own navigation to the request url has finished, except waitForNavigation, waitForSelector and waitForFunction.
    • addScriptTag / addStyleTag refuse path (no server file is read into the page).
    • waitForNavigation, waitForSelector and waitForFunction end with the render; their signal option is ignored. waitForFunction's root option must be an :class of the same request.
    const frame = page.frames().find((f) => f.name() === "content");
    await frame.click("#next");
    page.meta.log(await frame.title());
    Index
    detached: boolean

    true once the frame has detached

    • The first element matching selector in the frame, or null.

      Parameters

      • selector: string

      Returns Promise<ElementHandle>

    • Every element matching selector in the frame.

      Parameters

      • selector: string

      Returns Promise<ElementHandle[]>

    • Runs pageFunction(elements, ...args) on every element matching selector.

      Parameters

      • selector: string
      • pageFunction: PageFunction
      • ...args: any[]

      Returns Promise<any>

    • Runs pageFunction(element, ...args) on the first element matching selector; fails when none matches.

      Parameters

      • selector: string
      • pageFunction: PageFunction
      • ...args: any[]

      Returns Promise<any>

    • Adds a <script> from url or content and returns its element. path is refused.

      Parameters

      • options: { content?: string; id?: string; type?: string; url?: string }

        url, content, type, id

      Returns Promise<ElementHandle>

    • Adds a <link rel="stylesheet"> from url or a <style> from content and returns its element. path is refused.

      Parameters

      • options: { content?: string; url?: string }

      Returns Promise<ElementHandle>

    • The frame's child frames (synchronous).

      Returns Frame[]

    • Clicks the first element matching selector.

      Parameters

      Returns Promise<void>

    • The frame's full HTML.

      Returns Promise<string>

    • Runs pageFunction in the frame and returns its result as JSON.

      Parameters

      • pageFunction: PageFunction
      • ...args: any[]

        JSON values or handles passed to pageFunction

      Returns Promise<any>

    • Runs pageFunction in the frame and returns its result as a :class.

      Parameters

      • pageFunction: PageFunction
      • ...args: any[]

      Returns Promise<JSHandle>

    • Focuses the first element matching selector.

      Parameters

      • selector: string

      Returns Promise<void>

    • The <iframe> / <frame> element of this frame in its parent, or null for the main frame.

      Returns Promise<ElementHandle>

    • Navigates the frame to url and returns the main resource's response (:class, null for same-document navigations).

      Parameters

      • url: string
      • Optionaloptions: NavigationOptions & { referer?: string }

        timeout, waitUntil, referer

      Returns Promise<HTTPResponse>

    • Hovers the first element matching selector.

      Parameters

      • selector: string

      Returns Promise<void>

    • Whether the frame has detached (synchronous).

      Returns boolean

    • Creates a :class for selectorOrFunction in this frame (synchronous); see Page.locator.

      Parameters

      • selectorOrFunction: PageFunction

      Returns Locator

    • The frame's name attribute, or "" (synchronous).

      Returns string

    • The page object (page) the frame belongs to (synchronous).

      Returns any

    • The parent frame, or null for the main frame and detached frames (synchronous).

      Returns Frame

    • Selects values in the first <select> matching selector; returns the selected values.

      Parameters

      • selector: string
      • ...values: string[]

      Returns Promise<string[]>

    • Taps the first element matching selector.

      Parameters

      • selector: string

      Returns Promise<void>

    • The frame document's title.

      Returns Promise<string>

    • Focuses the first element matching selector and types text.

      Parameters

      • selector: string
      • text: string
      • Optionaloptions: { delay?: number }

        delay between key presses in milliseconds

      Returns Promise<void>

    • The frame's url (synchronous).

      Returns string

    • Waits until pageFunction returns a truthy value in the frame and returns that value as a :class. Does not wait for pjsc's own navigation first.

      Parameters

      • pageFunction: PageFunction
      • Optionaloptions: PageFnOptions

        timeout, polling ("raf", "mutation" or milliseconds)

      • ...args: any[]

      Returns Promise<JSHandle>