Misc

The Workflow Controller - A Browser UI for Live Automation

Opening the Controller

The controller is a web page served by GPALRestAPI. Open http://localhost:3000/controller in a browser to load it. GPALRestAPI tries port 3000 at startup and increments until it finds an open one, so several browsers on one machine each end up somewhere different. Which port belongs to which browser is a question the library answers: BrowserHelper.LiveRestApiHosts hands back the process id and port of every GPALRestAPI running right now, and a browser knows its own from RestApiBaseUrl.

// which hosts are up, and on what

BrowserHelper.LiveRestApiHosts(out List<(int processId, int port)> hosts);


foreach ((int processId, int port) host in hosts)

GPAL.PublishSimpleEvent(GPALEventType.NOTICE,

$"controller at http://localhost:{host.port}/controller, process [{host.processId}]");


// and the one this workflow is driving

GPAL.PublishSimpleEvent(GPALEventType.NOTICE, $"this browser [{browser.RestApiBaseUrl}]");

NOTE

Each host writes its own line into ports-in-use.log beside GPALRestAPI.exe and takes it back out on the way down, so what LiveRestApiHosts reports is what is up. It is OttoMagic only, because no other engine starts a GPALRestAPI. A port is assigned at startup and does not change while that instance is running.

Building and Saving Step Sequences

The builder presents every REST API endpoint as a selectable step -- navigate, click, type, scrape, switch tab, scroll, and more. Pick a step, configure its parameters, and run it immediately against the live browser page. Steps can be chained into a sequence and executed in order with the Run Workflow button. Use Save to download the sequence as workflow.json and Load to restore it later -- the file is specific to the controller and replays the same step list without re-entering each parameter.

NOTE

The workflow.json file the controller saves is a list of REST endpoint calls and parameters. It can be loaded back into the controller and re-run, but it is not a compiled GPAL workflow and cannot be directly imported into a C# program.

Remote Control from Another Machine

The controller can be opened from any browser on your local network -- not just the host machine. This makes it possible to control a browser running on a headless server or a separate workstation from your laptop. By default GPALRestAPI only accepts local connections. When it detects that remote access is blocked it displays a notification, generates the exact netsh commands for your IP and port, and copies them to the clipboard. Paste them into an elevated Command Prompt on the host, then restart GPALRestAPI.

// Run ONCE in an elevated Command Prompt

// on the machine running GPALRestAPI.

// GPALRestAPI generates and copies the exact

// commands for your IP and port to the clipboard

// when it detects remote access is blocked.


netsh http add urlacl url=http://192.168.1.x:3000/ user=Everyone


netsh advfirewall firewall add rule ^^

name="GPAL REST API - Port 3000 TCP Inbound" ^^

dir=in action=allow protocol=TCP ^^

localport=3000 profile=private


// Then restart GPALRestAPI.

NOTE

The firewall rule generated by GPALRestAPI uses profile=private, which limits access to your private LAN. Do not change it to profile=any unless you fully understand the exposure -- the controller can execute browser actions on the host machine with no authentication.

💬 Ask GPAL