Browser

Browser Settings and Engine

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. WithAutomationEngine sets the base automation engine (Selenium, Puppeteer, or OttoMagic) for the entire browser session - including a Hardware (HW) variant of each (SeleniumHW, PuppeteerPortHW, OttoMagicHW) that makes every selector in the session default to real OS-level mouse and keyboard input. WithCDPDebugPort and WithCDPDebugPipe choose how Selenium and Puppeteer reach the browser over the Chrome DevTools Protocol, a TCP port or a pipe, and the port wins when both are set. WithExistingCDPDebugPort drives a browser already listening on such a port instead of starting one. OttoMagic does not use DevTools at all, it talks HTTP to GPALRestAPI, so its equivalent is WithGPALRestAPIUrl, which takes the address that browser is serving on rather than a port. WithTempProfileDirectory sets where GPAL writes temporary browser profiles. WithNavigationGrace sets how long a navigation is allowed to settle before the workflow carries on. WithUserAgentFromBrowser takes the user agent string from the browser itself rather than a configured one.

NOTE

WithAutomationEngine 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. WithExistingCDPDebugPort 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

.WithExistingCDPDebugPort(9222) // debug port

.GoTo("https://example.com");

💬 Ask GPAL