PhantomJsCloud Automation API
    Preparing search index...

    Class JSHandle

    A reference to a JavaScript object in the page, returned by Page.evaluateHandle, Frame.evaluateHandle, Frame.waitForFunction, JSHandle.getProperty and Locator.waitHandle. Pass it as an argument to evaluate, $eval or $$eval to reach the object in the page.

    pjsc differences:

    • Handles end with the render; a handle from another request fails.
    • A render holds at most 5,000 live handles; release the ones you no longer need with JSHandle.dispose.
    const win = await page.evaluateHandle(() => window);
    const title = await win.evaluate((w) => w.document.title);
    await win.dispose();

    Hierarchy (View Summary)

    Index
    • Releases the handle. Disposing a disposed handle does nothing.

      Returns Promise<void>

    • Runs pageFunction(object, ...args) in the page and returns its result as JSON.

      Parameters

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

      Returns Promise<any>

    • Runs pageFunction(object, ...args) in the page and returns its result as a :class.

      Parameters

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

      Returns Promise<JSHandle>

    • The object's own enumerable properties, as a Map of name → :class.

      Returns Promise<Map<string, JSHandle>>

    • The property propertyName of the object, as a :class.

      Parameters

      • propertyName: string

      Returns Promise<JSHandle>

    • The object as JSON (JSON.stringify in the page, then parsed); fails for objects that cannot be stringified.

      Returns Promise<any>

    • A short description of the referenced object (synchronous).

      Returns string