Table of Contents

Class PuppeteerHandleExtensions

Namespace
PuppeteerSharp
Assembly
PuppeteerSharp.dll

IJSHandle and IElementHandle Extensions.

public static class PuppeteerHandleExtensions
Inheritance
PuppeteerHandleExtensions

Methods

EvaluateFunctionAsync(Task<IElementHandle>, string, params object[])

Runs pageFunction within the frame and passes it the outcome of elementHandleTask as the first argument.

public static Task EvaluateFunctionAsync(this Task<IElementHandle> elementHandleTask, string pageFunction, params object[] args)

Parameters

elementHandleTask Task<IElementHandle>

A task that returns an IElementHandle that will be used as the first argument in pageFunction.

pageFunction string

Function to be evaluated in browser context.

args object[]

Arguments to pass to pageFunction.

Returns

Task

Task.

Exceptions

SelectorException

If elementHandleTask resolves to null.

EvaluateFunctionAsync(Task<IJSHandle>, string, params object[])

Runs pageFunction within the frame and passes it the outcome of arrayHandleTask as the first argument. Use only after QuerySelectorAllHandleAsync(string).

public static Task EvaluateFunctionAsync(this Task<IJSHandle> arrayHandleTask, string pageFunction, params object[] args)

Parameters

arrayHandleTask Task<IJSHandle>

A task that returns an IJSHandle that represents an array of IElementHandle that will be used as the first argument in pageFunction.

pageFunction string

Function to be evaluated in browser context.

args object[]

Arguments to pass to pageFunction.

Returns

Task

Task.

EvaluateFunctionAsync<T>(IElementHandle, string, params object[])

Runs pageFunction within the frame and passes it the outcome the elementHandle as the first argument.

public static Task<T> EvaluateFunctionAsync<T>(this IElementHandle elementHandle, string pageFunction, params object[] args)

Parameters

elementHandle IElementHandle

An IElementHandle that will be used as the first argument in pageFunction.

pageFunction string

Function to be evaluated in browser context.

args object[]

Arguments to pass to pageFunction.

Returns

Task<T>

Task which resolves to the return value of pageFunction.

Type Parameters

T

The type of the response.

Exceptions

SelectorException

If elementHandle is null.

EvaluateFunctionAsync<T>(IJSHandle, string, params object[])

Runs pageFunction within the frame and passes it the outcome of arrayHandle as the first argument. Use only after QuerySelectorAllHandleAsync(string).

public static Task<T> EvaluateFunctionAsync<T>(this IJSHandle arrayHandle, string pageFunction, params object[] args)

Parameters

arrayHandle IJSHandle

An IJSHandle that represents an array of IElementHandle that will be used as the first argument in pageFunction.

pageFunction string

Function to be evaluated in browser context.

args object[]

Arguments to pass to pageFunction.

Returns

Task<T>

Task which resolves to the return value of pageFunction.

Type Parameters

T

The type to deserialize the result to.

EvaluateFunctionAsync<T>(Task<IElementHandle>, string, params object[])

Runs pageFunction within the frame and passes it the outcome of elementHandleTask as the first argument.

public static Task<T> EvaluateFunctionAsync<T>(this Task<IElementHandle> elementHandleTask, string pageFunction, params object[] args)

Parameters

elementHandleTask Task<IElementHandle>

A task that returns an IElementHandle that will be used as the first argument in pageFunction.

pageFunction string

Function to be evaluated in browser context.

args object[]

Arguments to pass to pageFunction.

Returns

Task<T>

Task which resolves to the return value of pageFunction.

Type Parameters

T

The type of the response.

Exceptions

SelectorException

If elementHandleTask resolves to null.

EvaluateFunctionAsync<T>(Task<IJSHandle>, string, params object[])

Runs pageFunction within the frame and passes it the outcome of arrayHandleTask as the first argument. Use only after QuerySelectorAllHandleAsync(string).

public static Task<T> EvaluateFunctionAsync<T>(this Task<IJSHandle> arrayHandleTask, string pageFunction, params object[] args)

Parameters

arrayHandleTask Task<IJSHandle>

A task that returns an IJSHandle that represents an array of IElementHandle that will be used as the first argument in pageFunction.

pageFunction string

Function to be evaluated in browser context.

args object[]

Arguments to pass to pageFunction.

Returns

Task<T>

Task which resolves to the return value of pageFunction.

Type Parameters

T

The type to deserialize the result to.