Class BrowserOptions
- Namespace
- Datafication.Connectors.WebConnector.Configuration
- Assembly
- Datafication.WebConnector.dll
Shared Puppeteer browser options for connectors that require JavaScript rendering.
public class BrowserOptions
- Inheritance
-
objectBrowserOptions
Remarks
These options are used when UseBrowser is set to true. The browser is used to render JavaScript-heavy pages that cannot be scraped with HTTP alone.
Properties
ExecutablePath
Gets or sets the path to a custom browser executable.
public string? ExecutablePath { get; set; }
Property Value
- string
Remarks
When null (default), Puppeteer will download and use its bundled Chromium. Set this to use a specific Chrome/Chromium installation.
Headless
Gets or sets whether to run the browser in headless mode.
public bool Headless { get; set; }
Property Value
- bool
Remarks
Headless mode runs the browser without a visible window. This is the default and recommended setting for server environments.
LaunchArgs
Gets or sets additional arguments to pass to the browser.
public string[]? LaunchArgs { get; set; }
Property Value
- string[]
Remarks
Common arguments include "--no-sandbox" for containerized environments and "--disable-gpu" for headless server environments.
PageLoadTimeoutMs
Gets or sets the page load timeout in milliseconds.
public int PageLoadTimeoutMs { get; set; }
Property Value
- int
Remarks
Default is 30000ms (30 seconds). Increase for slow-loading pages with heavy JavaScript execution.
PostLoadDelayMs
Gets or sets the delay in milliseconds after page load before scraping.
public int PostLoadDelayMs { get; set; }
Property Value
- int
Remarks
Some pages continue to load content after the initial page load event. Use this to add a delay for such pages. Default is 0 (no delay).
PostLoadScript
Gets or sets custom JavaScript to execute after page load.
public string? PostLoadScript { get; set; }
Property Value
- string
Remarks
Use this to click buttons, scroll pages, or trigger JavaScript that loads additional content. The script is executed after the page has loaded according to the WaitStrategy.
ViewportHeight
Gets or sets the viewport height in pixels.
public int ViewportHeight { get; set; }
Property Value
- int
Remarks
Default is 1080 pixels.
ViewportWidth
Gets or sets the viewport width in pixels.
public int ViewportWidth { get; set; }
Property Value
- int
Remarks
Default is 1920 pixels. Some responsive websites may show different content based on viewport size.
WaitStrategy
Gets or sets the wait strategy for page navigation.
public BrowserWaitStrategy WaitStrategy { get; set; }
Property Value
Remarks
Determines when the page is considered "loaded" and ready for scraping. NetworkIdle is the most reliable but slowest option.