Core Concepts

GPAL Actions

Selectors find elements - actions are what GPAL actually does to them. Clicking, typing, hovering, scraping into a grid, filling from a data source, and waiting are all actions, and every action runs against everything the current selectors matched.

Selectors Find, Actions Do

A selector only describes where to look. Nothing happens on the page until an action is called. Actions fall into a few families: interaction (LeftClick, RightClick, LeftDoubleClick, MiddleClick, Hover, SendString), data (GetGrid, FillInFrom), navigation (GoTo, Back, Forward, Refresh, NewTab, CloseTab), and timing (WaitFor). Every action operates on the element(s) found by the selector(s) declared since the last WithSelector - whether that is one element or a hundred.

Actions in a Workflow

A typical workflow alternates: define a selector, call an action, define the next selector, call the next action. Data actions like GetGrid and FillInFrom can take an optional output or input target so the result is captured or the form is populated from a source you already have.

browser

.WithSelector("#search")

.SendString("automation tools")

.WithSelector("#search-btn")

.LeftClick()

.WithSelector(".result-title")

.GetGrid(out var titles);

foreach (var row in titles)

Console.WriteLine(row[0]);

// Multiple actions on one selector - each action makes its own

// complete pass over every matched element before the next begins:

// Hover runs on all matched cards, then GetGrid runs on all matched

// cards, then LeftClick runs on all matched cards.

browser

.WithSelector(".product-card")

.Hover() // pass 1: hover every matched card

.GetGrid(out var cards) // pass 2: read content from every matched card

.LeftClick(); // pass 3: click every matched card

TIP

If selectors are the nouns of a GPAL workflow (what to find), actions are the verbs (what to do). Reading a workflow out loud - find this, click it, find that, type into it - is reading its actions in order.

Actions Do Not Close the Selector Set

Calling an action does not discard the selectors that produced its target elements - you can call another action right after and it runs against that same matched set again. Only the next WithSelector starts a fresh working set. This selectors-then-any-number-of-actions grouping is formalized as a Unit of Work, covered next.

WARNING

Some actions are browser-only (GoTo, NewTab, scrolling) and some apply to both Browser and Application targets (LeftClick, Hover, GetGrid). Check the action reference for your target type before relying on it.