Table of Contents

Class ConnectOptions

Namespace
PuppeteerSharp
Assembly
PuppeteerSharp.dll

Options for connecting to an existing browser.

public class ConnectOptions : IBrowserOptions, IConnectionOptions
Inheritance
ConnectOptions
Implements

Properties

BrowserURL

A browser url to connect to, in format http://${host}:${port}. Use interchangeably with browserWSEndpoint to let Puppeteer fetch it from metadata endpoin.

public string BrowserURL { get; set; }

Property Value

string

BrowserWSEndpoint

A browser websocket endpoint to connect to.

public string BrowserWSEndpoint { get; set; }

Property Value

string

DefaultViewport

Gets or sets the default Viewport.

public ViewPortOptions DefaultViewport { get; set; }

Property Value

ViewPortOptions

The default Viewport.

EnqueueAsyncMessages

Affects how responses to SendAsync(string, object, bool, CommandOptions) are returned to the caller. If true (default), the response is delivered to the caller on its own thread; otherwise, the response is delivered the same way MessageReceived events are raised.

public bool EnqueueAsyncMessages { get; set; }

Property Value

bool

Remarks

This should normally be set to true to support applications that aren't async "all the way up"; i.e., the application has legacy code that is not async which makes calls into PuppeteerSharp. If you experience issues, or your application is not mixed sync/async use, you can set this to false (default).

EnqueueTransportMessages

If not PuppeteerSharp.Transport is set this will be use to determine is the default WebSocketTransport will enqueue messages.

public bool EnqueueTransportMessages { get; set; }

Property Value

bool

Remarks

It's set to true by default because it's the safest way to send commands to Chromium. Setting this to false proved to work in .NET Core but it tends to fail on .NET Framework.

IgnoreHTTPSErrors

Whether to ignore HTTPS errors during navigation. Defaults to false.

public bool IgnoreHTTPSErrors { get; set; }

Property Value

bool

InitAction

Optional callback to initialize properties as soon as the IBrowser instance is created, i.e., set up event handlers.

public Action<IBrowser> InitAction { get; set; }

Property Value

Action<IBrowser>

Protocol

Protocol type..

public ProtocolType Protocol { get; set; }

Property Value

ProtocolType

ProtocolTimeout

Timeout setting for individual protocol (CDP) calls. Defaults to 180_000.

public int ProtocolTimeout { get; set; }

Property Value

int

SlowMo

Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.

public int SlowMo { get; set; }

Property Value

int

TargetFilter

Callback to decide if Puppeteer should connect to a given target or not.

public Func<Target, bool> TargetFilter { get; set; }

Property Value

Func<Target, bool>

TransportFactory

Optional factory for IConnectionTransport implementations.

public TransportFactory TransportFactory { get; set; }

Property Value

TransportFactory

WebSocketFactory

Optional factory for WebSocket implementations. If PuppeteerSharp.Transport is set this property will be ignored.

public WebSocketFactory WebSocketFactory { get; set; }

Property Value

WebSocketFactory