Browser

Browser Settings and Engine

Methods for configuring the browser type, driver location, download behavior, network settings, and automation engine mode.

Methods for configuring the browser type, driver location, download behavior, network settings, and automation engine mode.

WithBrowserType sets the browser (Chrome, Edge, Firefox). WithDriverLocation specifies where the WebDriver executable is located. WithBlockPopUps, WithLoadImages, and WithOpenPDFExternally control rendering behavior. WithDownloadLocation and WithDownloadTimeoutInSec configure file downloads. WithProfileName and WithProfileDataDirectory use a specific browser profile. WithWaitOnDocumentReady and WithWaitOnIdleConnection control when GPAL considers a page fully loaded. WithUseAutomationEngine sets the base automation engine (Selenium, Puppeteer, or OttoMagic) for the entire browser session - including a Hardware (HW) variant of each (SeleniumHW, PuppeteerPortHW, PuppeteerPipeHW, OttoMagicHW) that makes every selector in the session default to real OS-level mouse and keyboard input.

TIP

WithUseAutomationEngine selects the base automation engine - PuppeteerPort (the default, via Chrome DevTools Protocol), Selenium (via WebDriver), or OttoMagic - for the whole browser session, and cannot be changed once the browser is open. Choosing one of its HW variants (e.g. SeleniumHW) makes hardware-level input the default for every selector in the session, with no per-selector setting needed. Calling WithHardware or WithJavaScript right after WithSelector (either on the Selector itself or fluently on the Browser, which applies to the most recently defined selector) overrides only how that one selector is interacted with - hardware-level emulation or direct JavaScript injection - layered on top of the active base engine, and still applies even when a *HW engine is active.

Examples

GPAL Fluent: High-level fluent C# API

//Browser settings are applied before the first GoTo or Get call. WithExistingBrowser connects to a Chrome or Edge instance started with --remote-debugging-port set to the specified port.

// Full browser setup before navigation GPAL.Browser .WithBrowserType(BrowserType.Chrome) .WithDriverLocation("C:\drivers\chromedriver.exe") .WithDownloadLocation("C:\Downloads") .WithDownloadTimeoutInSec(30) .WithLoadImages(false) .WithWaitOnIdleConnection(true) .GoTo("https://example.com"); // Connect to an already-open browser instance GPAL.Browser .WithExistingBrowser(9222) // debug port .GoTo("https://example.com");