Core Concepts

Configuration Hierarchy

Broad to Specific

Many GPAL settings can be defined at more than one level: globally on the GPAL class (applies everywhere), on a Browser or Application object (applies to all operations on that instance), or on an individual Selector (applies to that selector only). A value such as the driver location is taken from the most specific level that sets it, while stop-on-not-found applies if any level turns it on. You only need to set what differs. Everything else inherits automatically.

Override in Practice

A typical pattern is to set the driver location globally, choose the automation engine on the browser instance, and then override interaction type or stop-on-not-found on specific critical selectors. The workflow reads cleanly because the exceptions are declared right where they apply. On the selector that needs them. Rather than managed through conditional code.

// Level 1 - global: applies to everything

GPAL

.WithDriverLocation("C:\drivers")

.WithStopOnNotFound(false);


// Level 2 - browser instance: overrides global for this browser

var browser = GPAL.Browser

.WithBrowserType(BrowserType.Chrome)

.WithAutomationEngine(AutomationEngine.Selenium)

.WithDriverLocation("D:\chrome-drivers")

.ToGPALObject();


// Level 3 - selector: most specific

var checkout = GPAL.Selector

.WithCSS("#checkout-btn")

.WithHardware // hardware interaction for this selector only

.WithStopOnNotFound(true) // this selector must be found

.ToGPALObject();

NOTE

A selector with no overrides takes its settings from its browser instance and from global. A clean workflow has almost no per-selector configuration. Only the exceptions are declared.

Global Callbacks

CallIfFound and CallIfNotFound follow the same three-level hierarchy. Set them globally on GPAL to fire for every selector in every workflow. Set them on a browser instance to fire for the selectors in the current unit of work. Set them on a selector to fire only for that selector. Multiple handlers at the same level chain via NotHandled -- each handler runs in order until one returns Handled, Terminate, or TryNext, at which point the rest of the chain at that level stops.

WARNING

Some global settings, such as the driver location, are copied into a Browser when it is created, so a later change does not reach it. Configure GPAL-level settings before creating any instances.

💬 Ask GPAL