References

OttoMagic: Browser Automation Without WebDriver

How OttoMagic Works

When you configure GPAL to use OttoMagic, it launches the browser with the profile you specify. The OttoMagic browser extension loads as part of that profile and starts GPALRestAPI -- a native Windows application that runs locally on the machine. GPAL then sends REST commands to GPALRestAPI over a local HTTP port, and GPALRestAPI marshals each command to the OttoMagic extension running inside the browser. Both pieces must be present: OttoMagic installed in the browser profile, and GPALRestAPI installed on the machine.

GPAL.Browser

.WithAutomationEngine(AutomationEngine.OttoMagic)

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

.WithSelector(".search-box")

.FillInFrom("automation")

NOTE

In GPAL workflows, OttoMagicClient provides the fluent typed interface that builds and dispatches REST requests to GPALRestAPI. MagicHelper exposes the same surface for direct use outside the selector workflow. GPALRestAPI exposes REST endpoints any app can call.

Pure JavaScript and MagicHelper

OttoMagic executes automation commands as JavaScript inside the browser through the OttoMagic extension. All GPAL automation engines implement the same complete feature set, so the same workflow runs identically across OttoMagic, Puppeteer, and Selenium without changes. OttoMagic's primary advantage is detection resistance: because it runs as a native browser extension rather than an external driver, sites are less likely to identify it as automation.

// Direct MagicHelper access to GPALRestAPI endpoints

GPAL.MagicHelper.InjectScript("window.__myFlag = true;");

var source = GPAL.MagicHelper.GetPageSource();

GPAL.MagicHelper.ScrollWindowByVertical(500);

NOTE

AutomationEngine.OttoMagicHW uses the same extension-based approach but fires real hardware mouse and keyboard events instead of JavaScript-driven interactions. Use it when a site's anti-automation detection specifically blocks synthetic events.

Frame Behavior and Choosing an Engine

With OttoMagic, selector searches scan all frames by default -- including the target frame -- so elements inside iframes are found without using InIframe. Use InIframe to narrow the search to a specific frame, which cuts down browser search overhead and reduces execution time.

// Open the UDP listener BEFORE OttoMagic

// launches

using var udp = new UdpClient(47623);

udp.Client.ReceiveTimeout = 30_000; // 30-second timeout

var remoteEp = new IPEndPoint(IPAddress.Any, 0);

byte[] data = udp.Receive(ref remoteEp);

string port = Encoding.UTF8.GetString(data).Trim();


// GPALRestAPI is now reachable at this port for the session

string baseUrl = $"http://localhost:{port}/";

// POST {baseUrl}/GoTo { "url": "https://example.com" }

// POST {baseUrl}/Query { "css": ".login-btn" }

NOTE

OttoMagic and Puppeteer work natively without a driver binary -- OttoMagic through the extension and GPALRestAPI, Puppeteer directly over Chrome DevTools Protocol. Selenium requires a WebDriver binary matched to the installed browser version. All three run the same GPAL workflow code without changes.

💬 Ask GPAL