Automation Engines

A Minimal OttoMagic Smoke Test

Complete Program

Here's the whole workflow, start to finish. Each piece is broken down and explained below.

using GenerallyPositive;

using GenerallyPositive.Browser;

using static GenerallyPositive.Enums;


GPAL

.WithPublishToConsole();


IBrowser browser = GPAL.Browser

.WithBrowserType(BrowserType.Chrome)

.WithUseAutomationEngine(AutomationEngine.OttoMagic)

.Maximize

.ToGPALObject();


browser.GoTo("www.example.com");


browser.Close(true);

Select OttoMagic as the Automation Engine

OttoMagic runs as a browser extension with a built-in local REST server - there is no install directory to point GPAL at. To use it, call WithUseAutomationEngine(AutomationEngine.OttoMagic) on the browser builder. GPAL contacts the extension at http://localhost:3000 by default; if you changed the port, set GPAL.OttoMagicRestApiBaseUrl before building any browsers.

GPAL

.WithPublishToConsole();


IBrowser browser = GPAL.Browser

.WithBrowserType(BrowserType.Chrome)

.WithUseAutomationEngine(AutomationEngine.OttoMagic)

.ToGPALObject();

NOTE

WithUseAutomationEngine lives on the individual browser builder, not at the global GPAL level. If you create several browsers in the same run, each one picks its engine independently. See Configuration Hierarchy.

Build a Maximized OttoMagic Browser

WithUseAutomationEngine(AutomationEngine.OttoMagic) tells this specific browser to drive itself through OttoMagic rather than Selenium or Puppeteer. Maximize is a fluent property - chain it onto the builder before ToGPALObject() and the window opens full-size instead of at its default dimensions.

IBrowser browser = GPAL.Browser

.WithBrowserType(BrowserType.Chrome)

.WithUseAutomationEngine(AutomationEngine.OttoMagic)

.Maximize

.ToGPALObject();

NOTE

Everything below ToGPALObject() works the same regardless of which AutomationEngine you picked - GoTo, Close, and the rest of the IBrowser surface don't change. See Automation Engines.

Navigate and Close

GoTo opens the URL in the visible browser window. Close(true) shuts down the underlying driver process once the test is done.

browser.GoTo("www.example.com");


browser.Close(true);

WARNING

Passing true kills the running driver process for this browser. If a smoke test like this passes - the window opens, the page loads, and it closes cleanly - that's a good sign your OttoMagic install path and driver setup are correct.

About the Real Test Program

The actual MagicTester project in the repo wraps this same workflow in nested loops over BrowserType, AutomationEngine, and headless/headful mode, skipping combinations that don't apply, so it can regression-test every valid OttoMagic configuration in one run. The single-pass version above is what each iteration of that loop boils down to.

NOTE

When you see a test program in the repo iterating over BrowserType and AutomationEngine with switch statements that mostly continue, it's testing every valid browser/engine/headless combination for regression purposes - not something you need in a normal workflow. See Automation Engines.

💬 Ask GPAL