Gherkin

Gherkin Setup

Methods for initializing the Gherkin runner with either a browser or desktop application target.

Methods for initializing the Gherkin runner with either a browser or desktop application target.

ForBrowser initializes a GPAL Browser instance with the specified browser type and driver location, making it available as the Browser property for use in step delegates. ForApplication opens the specified application executable and stores the Application instance. These are the two setup methods - call exactly one before the first Given step. The Browser and Application properties on the Gherkin instance expose the initialized automation objects for use within step delegates.

Examples

GPAL Fluent: High-level fluent C# API

//ForBrowser creates a new Browser instance but does not navigate - the first navigation happens inside your first step delegate. ForApplication calls Open on the Application, so the executable is launched immediately.

// Browser-based Gherkin spec var spec = GPAL.Gherkin .ForBrowser(BrowserType.Chrome, "C:\drivers\chromedriver.exe"); // Access the browser in step methods void SearchForProduct() { spec.Browser .WithSelector("#search") .FillInFrom("GPAL library"); } spec.Given(SearchForProduct); // Desktop application-based spec GPAL.Gherkin .ForApplication("C:\apps\myapp.exe") .Given(() => { /* step logic */ });