Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines $eval and $$eval for Page, Frame and ElementHandle.

Hierarchy

Index

Methods

Methods

$$eval

  • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

    If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    Parameters

    • selector: string

      A selector to query for

    • pageFunction: (elements: Element[]) => R | Promise<R>

      Function to be evaluated in browser context

        • (elements: Element[]): R | Promise<R>
        • Parameters

          • elements: Element[]

          Returns R | Promise<R>

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

  • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

    If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    • X1

    Parameters

    • selector: string

      A selector to query for

    • pageFunction: (elements: Element[], x1: UnwrapElementHandle<X1>) => R | Promise<R>

      Function to be evaluated in browser context

    • x1: X1

      First argument to pass to pageFunction

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

  • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

    If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    • X1

    • X2

    Parameters

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

  • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

    If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    • X1

    • X2

    • X3

    Parameters

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

  • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

    If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    Parameters

    • selector: string

      A selector to query for

    • pageFunction: (elements: Element[], ...args: any[]) => R | Promise<R>

      Function to be evaluated in browser context

        • (elements: Element[], ...args: any[]): R | Promise<R>
        • Parameters

          • elements: Element[]
          • Rest ...args: any[]

          Returns R | Promise<R>

    • Rest ...args: SerializableOrJSHandle[]

      Arguments to pass to pageFunction

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

$eval

  • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

    If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    Parameters

    • selector: string

      A selector to query for

    • pageFunction: (element: Element) => R | Promise<R>

      Function to be evaluated in browser context

        • (element: Element): R | Promise<R>
        • Parameters

          • element: Element

          Returns R | Promise<R>

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

  • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

    If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    • X1

    Parameters

    • selector: string

      A selector to query for

    • pageFunction: (element: Element, x1: UnwrapElementHandle<X1>) => R | Promise<R>

      Function to be evaluated in browser context

    • x1: X1

      First argument to pass to pageFunction

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

  • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

    If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    • X1

    • X2

    Parameters

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

  • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

    If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    • X1

    • X2

    • X3

    Parameters

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

  • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

    If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

    Type parameters

    • R

    Parameters

    • selector: string

      A selector to query for

    • pageFunction: (element: Element, ...args: any[]) => R | Promise<R>

      Function to be evaluated in browser context

        • (element: Element, ...args: any[]): R | Promise<R>
        • Parameters

          • element: Element
          • Rest ...args: any[]

          Returns R | Promise<R>

    • Rest ...args: SerializableOrJSHandle[]

      Arguments to pass to pageFunction

    Returns Promise<WrapElementHandle<R>>

    Promise which resolves to the return value of pageFunction

Generated using TypeDoc