Core Concepts

Configuration Hierarchy

GPAL settings flow from broad to specific. Configure once globally and override only where needed. At the browser or application object level, or at the individual selector level.

Broad to Specific

Every GPAL setting can be defined at three levels: 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). The most specific definition always wins. You only need to set what differs from the level above. Everything else inherits automatically.

Override in Practice

A typical pattern is to set the automation engine globally, set driver location 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

.WithAutomationEngine(AutomationEngine.Selenium)

.WithStopOnNotFound(false);

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

var browser = GPAL.Browser

.WithBrowserType(BrowserType.Chrome)

.WithDriverLocation(@"C:drivers")

.ToGPALObject();

// Level 3 - selector: most specific, overrides everything above

var checkout = GPAL.Selector

.WithCSS("#checkout-btn")

.WithHardware // overrides Selenium at global level

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

.ToGPALObject();

TIP

A selector with no overrides inherits everything from its browser instance, which inherits 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 all selectors on that browser. 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 TryNextSelector, at which point the rest of the chain at that level stops.

WARNING

Changing a global setting after a Browser or Application object is created does not affect that existing object. Always configure GPAL-level settings before creating any instances.