Getting Started

Your First Workflow

A GPAL automation workflow follows a simple three-step pattern: create a browser, navigate to a page, interact with elements. This page walks through the minimal working example.

The Pattern

Every GPAL workflow starts at the GPAL factory class. You create a Browser or Application object, navigate to your target, then build a chain of selector-plus-action steps. Each step is a Unit of Work - a selector that finds elements and an action that operates on them.

A Minimal Example

The example below opens Chrome, navigates to a page, reads the h1 heading text into a grid, and prints it. This is the complete, runnable form of the simplest possible GPAL workflow.

using GenerallyPositive;

using GenerallyPositive.Browser;

var browser = GPAL.Browser

.WithBrowserType(BrowserType.Chrome)

.ToGPALObject();

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

.WithSelector("h1")

.GetGrid(out var result);

Console.WriteLine(result[0][0]);

browser.Close();

TIP

The fluent chain configures the object. Nothing happens until ToGPALObject() is called - that is when GPAL creates the browser instance and launches the driver.

What Just Happened

GPAL.Browser.WithBrowserType(BrowserType.Chrome).ToGPALObject() launched Chrome and connected to it via PuppeteerPort - GPAL's default automation engine, which talks to Chrome directly over the Chrome DevTools Protocol using SDi's own custom Puppeteer implementation and needs no separate driver. GoTo navigated the browser. WithSelector defined the element to find. GetGrid executed the find, collected the text content of all matched elements, and returned a grid where each matched element is a row.

WARNING

Close(true) terminates all processes associated with that browser, including driver processes - this matters because chromedriver/edgedriver can hang and fail to exit on their own. Use Close(true) as your last call before exiting, or whenever no more browser automation is needed. Close() (the default, false) closes just this browser instance and leaves those processes running, so you can open another browser and reuse them.