Table of Contents

Namespace PuppeteerSharp

Classes

AddTagOptions

Options used by AddScriptTagAsync(AddTagOptions) & AddStyleTagAsync(AddTagOptions).

BoundingBox

Bounding box data returned by BoundingBoxAsync().

BoxModel

Represents boxes of the element.

BoxModelPoint

Represents a point.

Browser

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

BrowserContext

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

BrowserContextOptions

BrowserContext options.

BrowserFetcher

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

BrowserFetcherOptions

Browser fetcher options used to construct a BrowserFetcher.

CDPSession

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

ChromeLauncher

Represents a Chromium process and any associated temporary user data directory that have created by Puppeteer and therefore must be cleaned up when no longer needed.

ChromiumProcessException

Chromium process exception thrown by Launcher.

CommandOptions

Command options. See SendAsync<T>(string, object, CommandOptions).

ConnectOptions

Options for connecting to an existing browser.

ConsoleEventArgs

Console data.

ConsoleMessage

ConsoleMessage is part of ConsoleEventArgs used by Console.

ConsoleMessageLocation

Console message location.

CookieParam

Cookie data.

Credentials

Options to be used in AuthenticateAsync(Credentials).

CustomQueryHandler

Contains two functions queryOne and queryAll to be used as custom query handlers The functions queryOne and queryAll are executed in the page context.

DeviceRequestPrompt

Device request prompts let you respond to the page requesting for a device through an API like WebBluetooth.

DeviceRequestPromptDevice

Device in a request prompt.

DeviceRequestPromptManager

Prompt manager.

Dialog

Dialog objects are dispatched by page via the 'dialog' event.

DialogEventArgs

Dialog arguments.

DragData

Data returned by the drag methods.

DragDataItem

Item returned by drag methods.

ElementHandle

Inherits from IJSHandle. It represents an in-page DOM element. ElementHandles can be created by QuerySelectorAsync(string) or QuerySelectorAllAsync(string).

ElementScreenshotOptions

Options to be used in ScreenshotAsync(string, ElementScreenshotOptions), ScreenshotStreamAsync(ElementScreenshotOptions) and ScreenshotDataAsync(ElementScreenshotOptions).

EmulateIdleOverrides

Options for EmulateIdleStateAsync(EmulateIdleOverrides).

ErrorEventArgs

Error arguments.

EvaluationFailedException

Exception thrown by ExecuteEvaluationAsync(string, object).

ExecutionContext

The class represents a context for JavaScript execution. Examples of JavaScript contexts are: Each Frame has a separate IExecutionContext All kind of web workers have their own contexts.

FileChooser

FileChooser objects are returned via the WaitForFileChooserAsync(WaitForOptions) method. File choosers let you react to the page requesting for a file.

FirefoxLauncher

Represents a Firefox process and any associated temporary user data directory that have created by Puppeteer and therefore must be cleaned up when no longer needed.

Frame

Provides methods to interact with a single page frame in Chromium. One IPage instance might have multiple IFrame instances. At every point of time, page exposes its current frame tree via the MainFrame and ChildFrames properties.

IFrame object's lifecycle is controlled by three events, dispatched on the page object

  • FrameAttached - fires when the frame gets attached to the page. A Frame can be attached to the page only once
  • FrameNavigated - fired when the frame commits navigation to a different URL
  • FrameDetached - fired when the frame gets detached from the page. A Frame can be detached from the page only once.
FrameEventArgs

FrameAttached, FrameDetached and FrameNavigated arguments.

GeolocationOption

Geolocation option.

Initiator

Information about the request initiator.

JSHandle

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

LaunchOptions

Options for launching the Chrome/ium browser.

Launcher

Launcher controls the creation of processes or the connection remote ones.

LauncherBase

Represents a Base process and any associated temporary user data directory that have created by Puppeteer and therefore must be cleaned up when no longer needed.

MediaFeatureValue

Media Feature. EmulateMediaFeaturesAsync(IEnumerable<MediaFeatureValue>).

MessageEventArgs

MessageReceived arguments.

MessageException

Exception thrown by. SendAsync<T>(string, object, CommandOptions)

MetricEventArgs

Metrics arguments.

NavigationException

Exception thrown when a IPage fails to navigate an URL.

NavigationOptions

Navigation options used by WaitForNavigationAsync(NavigationOptions) and SetContentAsync(string, NavigationOptions).

NetworkConditions

Options to be used in EmulateNetworkConditionsAsync(NetworkConditions).

NewDocumentScriptEvaluation

New document information.

Page

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

PageCloseOptions

Page close options.

PageErrorEventArgs

Page error event arguments.

Payload

Payload information.

PdfOptions

Options to be used in PdfAsync(string, PdfOptions), PdfStreamAsync(PdfOptions) and PdfDataAsync(PdfOptions).

PopupEventArgs

Popup event arguments. Popup.

PredefinedNetworkConditions

Predefined network conditions.

ProcessException

process exception thrown by Launcher.

Puppeteer

Provides a method to launch a Chromium instance.

PuppeteerException

Base exception used to identify any exception thrown by PuppeteerSharp.

PuppeteerHandleExtensions

IJSHandle and IElementHandle Extensions.

RemoteAddress

Remote server address.

RequestEventArgs

Arguments used by IPage events.

Request<TResponse>

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

ResponseCreatedEventArgs

Response arguments.

ResponseData

Response that will fulfill a request.

Response<TRequest>

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

ScreenshotOptions

Options to be used in ScreenshotAsync(string, ScreenshotOptions), ScreenshotStreamAsync(ScreenshotOptions) and ScreenshotDataAsync(ScreenshotOptions).

SecurityDetails

Represents the security details when response was received over the secure connection.

SelectorException

Exception thrown when an element selector returns null.

SessionEventArgs

Session event arguments.

Target

Target.

TargetChangedArgs

Event arguments used by target related events.

TargetClosedException

Exception thrown by the Connection when it detects that the target was closed.

TargetInfo

Target info.

TimeoutSettings

Timeout settings.

Tracing

You can use StartAsync(TracingOptions) and StopAsync() to create a trace file which can be opened in Chrome DevTools or timeline viewer.

TracingOptions

Tracing options used on StartAsync(TracingOptions).

UserAgentBrandVersion

Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints.

UserAgentMetadata

Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints Missing optional values will be filled in by the target with what it would normally use.

ViewPortOptions

View port options used on SetViewportAsync(ViewPortOptions).

WaitForFunctionOptions

Optional waiting parameters.

WaitForNetworkIdleOptions

Optional waiting parameters.

WaitForOptions

Timeout options.

WaitForSelectorOptions

Optional waiting parameters.

WaitTaskTimeoutException

Timeout exception that might be thrown by WaitFor methods in Frame.

WebWorker

The Worker class represents a WebWorker (https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). The events WorkerCreated and WorkerDestroyed are emitted on the page object to signal the worker lifecycle.

WorkerEventArgs

Workder created event arguments.

Structs

Offset

Offset used in conjunction with ClickablePointAsync(Offset?).

Point

Represents a Point.

Interfaces

IBrowser

Provides methods to interact with a browser.

IBrowserContext

BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single IBrowserContext used by default. The method NewPageAsync() creates a IPage in the default IBrowserContext.

IBrowserFetcher

BrowserFetcher can download and manage different versions of Chromium.

IBrowserOptions

Browser options.

ICDPConnection

An ICDPConnection is an object able to send and receive messages from the browser.

ICDPSession

The CDPSession instances are used to talk raw Chrome Devtools Protocol:

Documentation on DevTools Protocol can be found here: https://chromedevtools.github.io/devtools-protocol/.

var client = await Page.Target.CreateCDPSessionAsync();
await client.SendAsync("Animation.enable");
client.MessageReceived += (sender, e) =>
{
     if (e.MessageID == "Animation.animationCreated")
     {
         Console.WriteLine("Animation created!");
     }
};
JObject response = await client.SendAsync("Animation.getPlaybackRate");
Console.WriteLine("playback rate is " + response.playbackRate);
await client.SendAsync("Animation.setPlaybackRate", new
{
    playbackRate = Convert.ToInt32(response.playbackRate / 2)
});
IConnectionOptions

Options for Connection creation.

IElementHandle

Inherits from IJSHandle. It represents an in-page DOM element. ElementHandles can be created by QuerySelectorAsync(string) or QuerySelectorAllAsync(string).

IExecutionContext

The class represents a context for JavaScript execution. Examples of JavaScript contexts are: Each Frame has a separate IExecutionContext All kind of web workers have their own contexts.

IFrame

Provides methods to interact with a single page frame in Chromium. One IPage instance might have multiple IFrame instances. At every point of time, page exposes its current frame tree via the MainFrame and ChildFrames properties.

IFrame object's lifecycle is controlled by three events, dispatched on the page object

  • FrameAttached - fires when the frame gets attached to the page. A Frame can be attached to the page only once
  • FrameNavigated - fired when the frame commits navigation to a different URL
  • FrameDetached - fired when the frame gets detached from the page. A Frame can be detached from the page only once.
IJSHandle

IJSHandle represents an in-page JavaScript object. JSHandles can be created with the EvaluateExpressionHandleAsync(string) and EvaluateFunctionHandleAsync(string, params object[]) methods.

IPage

Provides methods to interact with a single tab in Chromium. One IBrowser instance might have multiple IPage instances.

IRequest

Whenever the page sends a request, the following events are emitted by puppeteer's page: Request emitted when the request is issued by the page. Response emitted when/if the response is received for the request. RequestFinished emitted when the response body is downloaded and the request is complete.

If request fails at some point, then instead of RequestFinished event (and possibly instead of Response event), the RequestFailed event is emitted.

If request gets a 'redirect' response, the request is successfully finished with the RequestFinished event, and a new request is issued to a redirected url.

IResponse

IResponse class represents responses which are received by page.

ITarget

Target.

ITracing

You can use StartAsync(TracingOptions) and StopAsync() to create a trace file which can be opened in Chrome DevTools or timeline viewer.

Enums

BrowserTag

Browser tag.

ConsoleType

Console type used on ConsoleMessage.

DialogType

Dialog type.

DragOperation

Drag operations available on DragData.

HeadlessMode

Headless mode.

InitiatorType

Type of the Initiator.

MediaFeature

Meadia Feature. See EmulateMediaFeaturesAsync(IEnumerable<MediaFeatureValue>).

OverridePermission

Override permission.

Platform

Platform used by a BrowserFetcher.

ProtocolType

Protocol used to communicate with the browser.

RequestAbortErrorCode

Abort error codes. used by AbortAsync(RequestAbortErrorCode, int?).

ResourceType

Resource type.

SameSite

SameSite values in cookies.

ScreenshotType

Screenshot file type.

SupportedBrowser

Supported Browser.

TargetType

Target type.

VisionDeficiency

Types of vision deficiency to emulate using EmulateVisionDeficiencyAsync(VisionDeficiency).

WaitForFunctionPollingOption

An interval at which the pageFunction is executed.

WaitUntilNavigation

Wait until navigation.

Delegates

BrowserFetcherOptions.CustomFileDownloadAction

A custom download delegate.

LazyArg

A LazyArg is an evaluation argument that will be resolved when the CDP call is built.