/biloba-go:apifrom biloba-go
Terse reference for every Biloba Go method and matcher, grouped by area: selectors/locators, lifecycle, poll-config, navigation, cookies/storage, tabs, cross-origin iframes, DOM interactions, network stubbing, screenshots, page clock, and visual regression. Use to look up exact method or matcher names and signatures.
Ships in biloba-go. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Terse lookup for Biloba's Go API. Docs: https://onsi.github.io/biloba/. Sibling skills are named here without a prefix; invoke one with the same plugin prefix you loaded this skill under.
Naming conventions — assume these, they're only restated where an entry breaks them:
| Shape | Means |
|---|---|
Have* / Be* / Each* / Match* | a Gomega matcher. Each* = ≥1 match AND all satisfy (fails on zero matches). |
Get* | polls the first match until ready, returns the value. Optional trailing &ptr decodes it. |
Current*ForEach | snapshot over all matches, no poll, returns a slice (empty when nothing matches). |
*Immediately | acts on all current matches now, no poll. The long suffix is a "know what you're doing" smell. |
| (dual) | fully applied → polls, acts once, stops (b.Click("#go")). Under-applied → a matcher you poll (Eventually("#go").Should(b.Click())). |
Selectors: CSS strings, XPath (xpath), or Locators. b.Immediate() opts out of poll-by-default; rarely needed.
CSS is the default (stable #id/[data-testid], not styling classes); locators for a11y + text/label identifiers; XPath the rare axis/ordinal tool. Speed: CSS > XPath > locators (full-document ARIA scan).
"#id", .cls, :has(). >>> pierces one open-shadow-root / same-origin-iframe boundary per occurrence. A cross-origin iframe needs a frame handle (b.Frame, below) — no selector reaches into it from the page.b.XPath(...) — pierces neither.*Contains variant on every text-valued one): b.ByRole(r), b.ByText, b.ByLabel, b.ByPlaceholder, b.ByAltText, b.ByTitle, b.ByTestID(id) (attr = biloba.TestIDAttribute, default "data-testid"), b.ByCSS(sel) — raw CSS into the algebra, the only structural constructor (b.ByCSS(".story").Nth(1) for "the 2nd", not :nth-of-type). They pierce open shadow roots automatically. Accessible name covers aria-labelledby/aria-label/<label>/alt/placeholder/value/text/figcaption/caption/title..WithName(n)/.WithNameContains(n), .Level(n), .Checked()/.Disabled()/.Expanded()/.Pressed()/.Selected()..ContainingText/.NotContainingText, .Containing/.NotContaining, .And/.Or, .Within/.NotWithin, .Nth(i)/.First()/.Last(). E.g. b.ByRole("listitem").Containing(b.ByText("Delete")).Within("#cart").First().Eventually("#published-list").Should(b.Exist())
Consistently(b.ByTextContains("Draft").Within("#published-list")).ShouldNot(b.Exist())
biloba.SpinUpChrome(GinkgoT(), ...SpinUpOption) — start Chrome (process 1). Options: HighFidelityHeadless(), AutoInstallHeadlessShell(), HeadlessShellPath(p), StartingWindowSize(w,h), ChromeFlags(...), ChromeSandbox(enabled) (overrides the automatic Linux --no-sandbox). → setupbiloba.ConnectToChrome(GinkgoT(), ...BilobaConfig) — open this process's root tab b. Config → debug-failuresb.Prepare() — reset the root tab between specs (BeforeEach, OncePerOrdered).b.Context — the tab's chromedp context (escape hatch).Shallow *Biloba clones (like Realistic()); not reset by Prepare(). Use per-call: b.WithTimeout(5*time.Second).Click("#go").
b.WithTimeout(d) · b.WithPolling(d) · b.WithContext(ctx) (cancellation aborts the wait) · b.Immediate() (act once, fail fast).
Four-bucket rule — misapplying a knob is a hard error:
| Bucket | Methods | WithTimeout/WithContext | WithPolling | Immediate |
|---|---|---|---|---|
| Polling | dual actions, value-getters (incl. GetLocation/GetTitle/GetJSValue) | ✓ | ✓ | ✓ |
| Waiting command | Navigate, Capture*Screenshot* (own ~30s/~5s defaults), HoldResponse+ResponseHold.Await (own 30s), Clock().RunFor (own 10s) | ✓ (overrides own default) | error | error |
| Snapshot | HasElement/Count/Current*ForEach/AllRequests/AllConsoleMessages/AllPageErrors/ResponseHold.Count/… | error | error | error |
| One-shot mutation | SetCookie/StubRequest/*Immediately/Run/RunAsync/InstallClock and the other clock methods/… | error | error | error |
b.Pointer() is its own small bucket: it accepts every knob and keeps the view, MoveToElement polls with those knobs, and MoveTo/Down/Up dispatch immediately and ignore them.
Configuring anything that resolves to a bare matcher — a (matcher) method (b.HaveScreenshot(name), b.Exist(), …), or the under-applied dual form (b.WithTimeout(d).Click()) — is also a hard error. Configure the Eventually, not the matcher.
Separate from all four: the CDP backstop. Every command Biloba sends Chrome carries a deadline (30s; 2min for RunAsync, whose length is set by the promise your page awaits) so an unresponsive Chrome fails the spec instead of hanging the suite. Not configurable and not a knob — WithTimeout bounds retries, not liveness, and does not shorten it. Every bucket gets it, including the two that reject every knob. Failures read deadline_exceeded / page_crashed / tab_closed / browser_gone → debug-failures.
.Capture(&target)Every matcher that reads a value off the page returns a *ValueMatcher with .Capture(&x): it writes what it observed on a successful match (nothing on ShouldNot), so the gate and the read are one read (asserting then re-reading with a getter is two reads of a page that may have changed — TOCTOU). Decoded into your Go type, à la encoding/json. Full rules — typed decode, absent-vs-zero (**T), returns-a-new-matcher, narrowing JS objects vs. Biloba structs — → flaky-specs §1.
var blockID string
Eventually(".figure-frame").Should(b.HaveAttribute("data-block-id", Not(BeEmpty())).Capture(&blockID))
HaveAttribute, HaveProperty (both forms incl. existence-only), HaveValue, HaveInnerText, HaveTextContent, HaveText, HaveClass, HaveCount, HaveDistinctCount, HaveJSONAttribute, HaveComputedStyle, HaveComputedStyleNumeric, EachHaveInnerText, EachHaveTextContent, EachHaveClass, EachHaveProperty (both forms — the existence-only form reads values in the same round-trip, so no-arg EachHaveInnerText()/EachHaveTextContent() capture too), HaveBoundingBox, HaveScrollOffset, HaveOffsetTopWithin/HaveOffsetLeftWithin (both forms incl. existence-only), HaveGapBetween (both forms incl. existence-only), EvaluateTo, HaveURL, HaveTitle, HaveLocalStorageItem/HaveSessionStorageItem, HaveNumLocalStorageItems/HaveNumSessionStorageItems, HaveNumCookies, HaveCookie.Exist, BeVisible, BeEnabled, BeClickable, BeFocused, BeChecked, BeInViewport, BeAbove/BeBelow/BeLeftOf/BeRightOf/Encloses/Overlaps/BePrecededBy/BeFollowedBy, BeNetworkIdle, HaveScreenshot — and the actions-as-matchers (Click, SetValue, Type, …). Two read something but stay bare on purpose: MatchColor (a sub-matcher — capture off the HaveComputedStyle you hand it to) and HaveMadeRequest (a *RequestQuery builder; it renders observed requests in its failure message, and the request object comes from b.AllRequests().Find(b.RequestMatching(...))).any-returning getters take an optional trailing pointer with the same decode rules — b.GetProperty("#row", "offsetWidth", &n), b.GetAttribute, b.GetValue, b.CurrentPropertyForEach, b.CurrentAttributeForEach, b.CurrentValueForEach. The value is still returned.b.Navigate(url) — navigate, assert 200. / b.NavigateWithStatus(url, code).b.GetLocation() / b.GetTitle() → string — polling getters, all four knobs. A transient CDP error mid-navigation (Inspected target navigated or closed (-32000)) is a retryable miss.b.HaveURL(string|matcher) / b.HaveTitle(string|matcher) — same transient-error behavior.Eventually("#dashboard-root").Should(b.Exist()) proves the navigation landed; a GetLocation() read is then a formality.b.SetCookie(...Cookie) (default domain = current URL) · b.GetCookies() → Cookies · b.ClearCookies().b.HaveCookie(name|matcher) — chain .WithValue/.WithPath/.WithDomain/.WithSameSite/.WithSecure(...)/.WithHTTPOnly(...).b.CookieMatching(...) — predicate for Cookies.Find/Filter. · b.HaveNumCookies(int|matcher).b.LocalStorage() / b.SessionStorage() → Set(k,v), Get(k,&ptr), GetAll(), Remove(k), Clear(), Length() (JSON round-tripped).b.HaveLocalStorageItem(key[, value]) / HaveSessionStorageItem / HaveNumLocalStorageItems / HaveNumSessionStorageItems.b.NewTab() → *Biloba — isolated tab (own context); closed by Prepare().tab.Close() → error (Eventually(tab.Close).Should(Succeed()) during downloads).b.AllTabs() / b.AllSpawnedTabs() → Tabs.b.HaveTab() / b.HaveSpawnedTab() — chain .WithURL/.WithTitle/.WithDOMElement(selector).b.TabMatching() — predicate for Tabs.Find/Filter.b.Frame(query) → *Biloba frame handle — polls until a cross-origin frame below b matches (honors all four knobs; fails the spec on timeout). Every DOM method, matcher, getter, .Capture, Run/JSFunc, SetUpload, Realistic(), screenshot and HaveScreenshot works on the handle and runs in the frame's document.b.FrameMatching() / b.HaveFrame() → FrameQuery — chain .WithURL/.WithTitle/.WithDOMElement(selector); Eventually(b).Should(b.HaveFrame()...) polls it.b.AllFrames() → Frames snapshot (Find/Filter); includes frames nested behind a boundary. frame.Frame(...) / frame.AllFrames() search inside a frame.frame.IsFrame(); frame.Close() detaches the handle (Prepare() discards all of them).Navigate, Prepare, NewTab, SetWindowSize, SetMedia, SetUserAgent, the environment emulation (SetGeolocation/ClearGeolocation, SetPermissions/ResetPermissions, SetLocale, SetTimezone, SetNetworkState/SetOffline, SetCacheEnabled), AddInitScript, InstallClock/Clock, SetCookie/ClearCookies, StubRequest/AbortRequest/ModifyRequest/ModifyResponse/HoldResponse, dialog handlers/Dialogs, downloads, StartScreencast. Call them on the tab — its stubs cover the frame's requests and its dialog handling covers the frame's dialogs.frame_detached — call b.Frame(...) again.iframe element from the tab), the tab's network stubs don't reach its requests, and realistic mode can't see what the embedding page draws over it.b.HasElement(selector) → bool (first; snapshot) · b.Exist().b.Count(selector) → int (snapshot) · b.HaveCount(int|matcher).b.HaveDistinctCount(attribute, int|matcher) — count of distinct values attribute takes across matches (dedupes double-painted nodes by a stable data-* key).b.BeVisible() — non-zero offsetWidth/offsetHeight. · b.BeEnabled() — !el.disabled. · b.BeClickable() — visible + enabled + topmost at its center (deterministic occlusion guard; Click does not run it). · b.EachBeVisible() / b.EachBeEnabled().Each* matcher means "≥1 match AND all satisfy" — it fails on zero matches instead of passing vacuously. Assert nothing matches with HaveCount(0) / ShouldNot(b.Exist()).b.GetInnerText(selector) → string (polls on presence — "" is a valid value) · b.HaveInnerText(string|matcher) (exact).b.GetTextContent(selector) → string · b.HaveTextContent(string|matcher).b.HaveText(string|matcher) — trims & collapses whitespace first.b.CurrentInnerTextForEach(selector) → []string · b.EachHaveInnerText(value|matcher). Same pair for CurrentTextContentForEach/EachHaveTextContent. The no-arg EachHaveInnerText()/EachHaveTextContent() assert the property is defined on every match, and capture the slice — they do not mean "every text is empty". Sub-matcher and .Capture both see a typed []string (the same slice the Current*ForEach getter returns), so Equal([]string{...}) and HaveExactElements(...) both work — contrast the generic EachHaveProperty below, which hands over raw []any.b.HaveClass(string|matcher) — a string ⇒ "list contains"; a matcher receives []string. · b.EachHaveClass(string).b.HaveAttribute(name[, string|matcher]) — via getAttribute.b.HaveComputedStyle(prop, string|matcher) — via getComputedStyle; getter b.GetComputedStyle (see Geometry).b.BeChecked(). An element with no checked property at all is an error, not "unchecked" — selecting the wrapping <label>/<div> fails loudly instead of letting ShouldNot(b.BeChecked()) pass forever.b.BeFocused() — is document.activeElement.. paths like dataset.name; JS types preserved — numbers are float64)Two-axis polling: the singular Get* getters poll until the element is present AND every named property/attribute is defined.
disabled on a <div>) blocks the poll to timeout. Wrap it — b.GetProperty("div.card", b.AllowMissing("disabled")) yields nil, no wait. Name params take string or AllowMissing; AllowMissing applies to GetProperty/GetProperties/GetAttribute/GetAttributes only.b.GetProperty(selector, name[, &ptr]) → any · b.SetProperty(selector, name, value) (dual) · b.HaveProperty(name[, value|matcher]) (matcher).b.GetProperties(selector, ...names) → Properties; GetString/GetInt/GetFloat64/GetBool/GetStringSlice.b.GetAttribute(selector, name[, &ptr]) → any (raw getAttribute markup, not the resolved property) · b.GetAttributes(selector, ...names) → Properties.b.GetJSONAttribute(selector, attribute, &out) (polls until present, set, and JSON-parseable, then decodes into *struct/*map/*any) · b.HaveJSONAttribute(attribute, matcher) — hands the sub-matcher the decoded value (map[string]any/[]any/float64); composes with gstruct.nil for absent, gate presence first with Eventually(sel).Should(b.HaveCount(n)): b.CurrentPropertyForEach(selector, name[, &ptr]) → []any · b.CurrentPropertiesForEach(selector, ...names) → SliceOfProperties (.Get(key), .Find(key, val|matcher), .Filter(key, val|matcher)) · b.CurrentAttributeForEach · b.CurrentAttributesForEach.
Ω(b.CurrentInnerTextForEach(".row")).ShouldNot(ContainElement("Draft")) passes against zero rows). The HaveCount(n) gate keeps the negative honest. Positive assertions are safer — Gomega's HaveEach errors on an empty slice.b.SetPropertyForEachImmediately(selector, name, value) — all matches now, no poll. · b.EachHaveProperty(name[, ...]) — sub-matcher and .Capture see the raw JSON-decoded []any (properties are heterogeneous, nothing honest to convert to); Equal([]string{...}) always fails here — use HaveExactElements(...).b.GetValue(selector[, &ptr]) → any (polls on presence only — ""/unselected radio is a valid value; bool for checkbox, checked radio's value, []string for multi-select) · b.CurrentValueForEach(selector[, &ptr]) → []any.b.SetValue(selector, value) (dual) — requires visible+enabled; focuses, sets, fires input+change. Does not type real keys (use b.Type). For a <select> the value matches the option value, not its visible label.b.ValueLabel(label) — wrap a SetValue arg to target a <select> option by visible label: b.SetValue(sel, b.ValueLabel("Sonnet")). Multi-select: pass a slice (labels and raw values may mix). <select> only.b.HaveValue(value|matcher).b.Run geometry)Getters poll until the element is present AND laid out (non-degenerate box). All values are viewport-relative CSS pixels. Each getter has a Have* matcher counterpart.
A missing element is an error, not a non-match. So Eventually("#toast").ShouldNot(b.BeInViewport()) times out — Gomega never counts an erroring matcher as satisfied, in either direction. Assert disappearance with ShouldNot(b.Exist()) or Should(b.HaveCount(0)); keep geometry matchers for elements that are there. Applies to HaveBoundingBox/HaveScrollOffset/HaveOffsetTopWithin/HaveOffsetLeftWithin/HaveGapBetween, the pairwise matchers, and any Consistently(sel).ShouldNot(...) on a conditionally-rendered sel. Under Eventually an error is still just a failed attempt, and a present-but-zero-area box is a silent retry, so positive assertions poll through late layout. (Same as BeVisible/BeEnabled/BeClickable. The pairwise/offset probes name which selector went missing: subject, container, or other.)
b.GetBoundingBox(selector) → Box{Top,Left,Width,Height,Bottom,Right,CenterX,CenterY,ClientWidth,ClientHeight} · b.HaveBoundingBox(matcher) (receives the Box; compose with HaveField). Width/Height are border-box (incl. scrollbar gutter, like getBoundingClientRect); ClientWidth/ClientHeight are the client box (content+padding, scrollbar excluded) — "content width of this scroll container".b.GetScrollOffset(selector) → ScrollOffset{Top,Left,MaxTop,MaxLeft} (Top==MaxTop ⇒ scrolled to bottom) · b.HaveScrollOffset(matcher).b.GetOffsetTopWithin(selector, container) → float64 (element.top - container.top) · b.GetOffsetLeftWithin · b.HaveOffsetTopWithin(container[, value|matcher]) · b.HaveOffsetLeftWithin(...). No-arg form is existence-only: passes once both selector and container are laid out, without asserting on the offset value (and still captures it).GetBoundingBoxes): b.BeAbove(other) (subject.Bottom<=other.Top), b.BeBelow, b.BeLeftOf (subject.Right<=other.Left), b.BeRightOf, b.Encloses (all 4 edges), b.Overlaps. All matchers: Eventually(subject).Should(b.BeAbove(other)).b.GetGapBetween(selector, other) → BoxDelta{Top,Left,Bottom,Right,Width,Height,CenterX,CenterY} (subject minus other; CenterX~0 ⇒ shared center line, Width~0 ⇒ same size) · b.HaveGapBetween(other[, value|matcher]). No-arg form is existence-only: passes once both elements are laid out, without asserting on the delta (and still captures it).b.BeInViewport(options...) — laid out and intersecting the visible layout viewport (≠ BeVisible, which is only "rendered"). Partial overlap counts; b.Fully() requires all 4 edges on screen.b.BePrecededBy(other) / b.BeFollowedBy(other) — document order via compareDocumentPosition. Read the subject first: Should(b.BeFollowedBy(Y)) ⇔ X comes BEFORE Y; Should(b.BePrecededBy(Y)) ⇔ X comes AFTER Y. A backwards assertion doesn't flake — it silently passes on a fixture satisfying the inverse, so pin both sides (Ω(X).ShouldNot(b.BePrecededBy(Y))). Failure messages report the observed order (Actually: #note comes BEFORE #section.). "Anywhere after" includes inside — scope with Locator.NotWithin.b.GetComputedStyle(selector, property) → string (getPropertyValue, so kebab-case names and custom properties like --stage resolve).b.GetComputedStyleNumeric(selector, property) → float64 (leading number via parseFloat: "16px"→16; non-numeric fails) · b.HaveComputedStyleNumeric(property, number|matcher) — a plain number compares with BeNumerically.b.NormalizeColor(color) → string (pure transform: no selector, no poll) — any CSS <color> incl. a var(--token) chain (resolved against :root) → canonical rgb()/rgba(). · b.MatchColor(color) — normalizes both sides; pass as the expected: b.HaveComputedStyle("stroke", b.MatchColor("var(--tok-teal)")).b.Click(selector) (dual) — visible+enabled, then el.click().b.DblClick (dual) — two clicks + dblclick. · b.RightClick — mousedown/mouseup/contextmenu. · b.MiddleClick — mousedown/mouseup/auxclick.b.Tap(selector) (dual) — synthetic touch/pointer + click (realistic: real CDP touchStart/touchEnd); accepts b.At(...), ignores modifiers.b.At(x,y) (offset from top-left; canvas/map/slider) and b.Shift()/b.Ctrl()/b.Alt()/b.Meta() (⌘/Win) — accepted by Click/DblClick/RightClick/MiddleClick/Tap, after the selector or in place of it (matcher form). They compose: b.Click(sel, b.At(30,40), b.Shift()). In fast mode any option switches the click off native el.click() to a synthetic event carrying coords+flags.b.DragTo(source, target) (dual) — pointer-based drag (pointerdown/move/up); drives @dnd-kit-style DnD, not native HTML5 draggable. Matcher subject is the source. In realistic mode both endpoints are measured at one scroll position (so a drag between two rows of one scroller works) and it fails, naming both, when no position shows them together.b.ScrollWheel(selector, deltaX, deltaY) (dual; matcher form drops the selector) — wheel event then scrolls the nearest scrollable ancestor; +deltaY=down, +deltaX=right.b.ClickEachImmediately(selector) — click all visible+enabled matches now, no poll (gate presence first).b.Focus / b.Blur / b.Hover (all dual; Hover fires pointer/mouse events, not CSS :hover).b.ScrollIntoView(selector, ...ScrollOption) (dual) — bare = native scrollIntoView(). Options: b.WithinScroller(container) (a specific container, not the nearest ancestor), b.AtTopOffset(px) (land px below the container top — "clear the sticky header"). Instant, occlusion-unaware.scrollIntoView, no focus move. Scroll-into-view comes only from Realistic() and from focus-bearing ops (Focus/SetValue/Type).Each produces a genuine window.getSelection() range and dispatches mouseup (drives highlight→menu/annotation UIs).
b.SelectText(selector) (dual) — all of the element's text.b.SelectText(selector, substring[, b.Occurrence(n)]) (dual) — a substring; first occurrence by default, b.Occurrence(n) is 1-based. The matcher form requires an explicit b.Occurrence(n) so it can't be confused with select-all: Eventually("#passage").Should(b.SelectText("fox", b.Occurrence(2))).b.SelectRange(selector, start, end) (dual; matcher form drops the selector) — chars [start, end) across the element's text nodes; fails the spec if out of bounds.b.ClearSelection() — no matcher form.Eventually("window.getSelection().toString()").Should(b.EvaluateTo(…)).realistic-modeb.Realistic() → *Biloba — a view of the same tab routed through real CDP input: scrolls into view, waits for stability, refuses to click through an occluding overlay, moves the real pointer (CSS :hover activates), dispatches genuine mouse/touch/key input. The whole interaction vocabulary works on it; it composes with the poll-config clones (b.Realistic().WithTimeout(d).Click(sel)). No per-call decorator. Per-spec opt-in — real round-trips, can reintroduce flake.
b.Pointer(opts...) → *Pointer — a real CDP pointer driven one event at a time (drawing, slider scrubbing, mid-drag asserts); a mouse unless b.Pen() (pointerType: "pen"). No scroll, no stability wait, dispatches at once — the caller paces it. Works on a frame handle (frame-viewport coords). Released at spec end if left pressed.
p.MoveTo(x, y) — viewport CSS px. p.Down() / p.Up() — press/release the primary button at the current point (moves while down carry buttons: 1).p.MoveToElement(sel, b.At(dx, dy)?) — center or top-left offset; polls for exists + visible with the knobs of the view it came from (b.WithTimeout(d).Pointer()); fails if the point is outside the viewport.b.Type(...) (dual) — the element-targeted keyboard method: focuses (which scrolls into view), then genuine keystrokes (text and named Keys.*); appends. Arg disambiguation (after stripping modifiers):
b.Type(selector, payload...) — polling form: selector + ≥1 payload arg. b.Type("input", "hello", biloba.Keys.Enter).b.Type(payload) — matcher form: a single string, or one-or-more Keys.*. Eventually("#in").Should(b.Type(biloba.Keys.Enter)).b.Type("hello", Keys.Enter) reads as selector="hello"). Use the polling form.b.SendKeysToWindowImmediately(...parts) — focus-free, no selector, no matcher, no poll: lands on the focused element, else fires on document/window (global hotkeys). Gate it yourself: Eventually(sel).Should(b.BeFocused()) then send. To type into an element use b.Type.biloba.Keys.{Enter,Tab,Escape,Backspace,Delete,Arrow{Up,Down,Left,Right},Home,End,PageUp,PageDown}.b.Shift()/b.Ctrl()/b.Alt()/b.Meta() (same values as the pointer modifiers) work here too, in any position: b.Type("textarea", biloba.Keys.Enter, b.Shift()). With Ctrl/Alt/Meta held a key is a shortcut: keydown/keyup fire with the flag set, but there is no keypress and no text is typed (b.Type("input", "a", b.Meta()) leaves the value alone). Shift alone still types. To type a character Option makes on macOS, send the character itself.b.SetUpload(selector, ...paths) (dual) — set <input type=file> files via CDP (paths must exist on Chrome's machine); fires change. Matcher form: b.SetUpload(path) or, for multiple files, a single b.SetUpload([]string{...}) (bare variadic paths would be ambiguous with the immediate form).b.InvokeOn(selector, method, ...args) → any — el[method](...args). · b.InvokeOnEachImmediately(...) → []any.b.InvokeWith(selector, jsFn, ...args) → any — jsFn(el, ...args). · b.InvokeWithEachImmediately(...) → []any.Prepare; register handlers BEFORE the triggering action)b.HandleAlertDialogs() / HandleConfirmDialogs() / HandlePromptDialogs() / HandleBeforeunloadDialogs() → DialogHandler; chain .MatchingMessage(string|matcher), .WithResponse(bool), .WithText(s). · b.RemoveDialogHandler(h). The most recently registered matching handler wins, so registering WithResponse(true) after WithResponse(false) flips the next dialog's answer; remove the newer handler to fall back to the older one.b.Dialogs() → Dialogs, filtered with .OfType(biloba.DialogTypeAlert|DialogTypeConfirm|DialogTypePrompt|DialogTypeBeforeunload), .MatchingMessage(string|matcher), .MostRecent(). There is no dialog matcher — assert with plain Gomega: Ω(b.Dialogs().MostRecent()).Should(HaveField("Message", "…")).Dialog{Type, Message, DefaultPrompt, HandleResponse, HandleText, Autohandled} (Autohandled = no registered handler matched, so a Biloba default ran).beforeunload that Prepare's own about:blank navigation raises when it unloads the previous spec's page, which is accepted silently and left out of b.Dialogs().b.AllDownloads() / b.AllCompleteDownloads() → Downloads.b.HaveDownloaded([filename]) — chain .WithURL(...), .WithContent([]byte|matcher); complete downloads only.b.DownloadMatching(...) — predicate for Downloads.Find.Download: .URL, .Filename, .IsComplete()/.IsCancelled()/.IsActive(), .Content() → []byte.window; wrap object literals in parens)b.Run(script[, &ptr]) → any — a synchronous expression; returns the decoded value. A top-level return is illegal (errors with a hint pointing at RunAsync/IIFE). Pollable: Eventually(b.Run).WithArguments(expr).Should(matcher) — it's a func(string,...any) any. → flaky-specsb.RunAsync(script[, &ptr]) — runs in an async fn (use for await/fetch). A single expression without return returns its value ((await fetch(u)).status); a script with statements or any return (even inside a callback) is the fn body, so return the value.b.AddInitScript(script) — runs at the start of every document the tab loads afterwards (before the page's scripts, in its frames too); not in the current document, so call it before Navigate. Removed by its own DeferCleanup at spec end.b.AllConsoleMessages() → []ConsoleMessage (Type "log"/"info"/"warning"/"error"/…, Text = args space-joined, Timestamp, Stack; Chrome's own messages — failed loads, interventions, violations — are included with a non-empty Source, tab-only; their warnings/errors stream to the GinkgoWriter as [source] text (url) but are not replayed on failure) · b.AllPageErrors() → []PageError (uncaught exceptions + unhandled rejections; Message like "Uncaught TypeError: …"/"Uncaught (in promise) Error: …", URL, Line/Column zero-based, Stack, Timestamp). Printed locations (url:line:col in the stream, stack traces, failure replay) are one-based. Snapshots since the last Prepare, most recent 1000 kept; poll with Eventually(b.AllPageErrors). A frame handle sees only its document's; the tab sees its frames' too. Page errors also stream to the GinkgoWriter and join the replayed console errors on failure.b.RunErr(script, ...args) / b.RunErrAsync(...) → (any, error) — error-returning siblings; handle the error yourself instead of failing the spec.b.EvaluateTo(value|matcher) — assert a JS expression's result. Numbers decode to float64 — BeNumerically, not Equal(intLiteral). Asymmetry: the sub-matcher sees the raw JSON-decoded value ([]any of map[string]any — HaveKeyWithValue, not HaveField); .Capture(&typed) hands you the value decoded into your struct.b.JSFunc(script) → .Invoke(...args) string — JSON-encodes args into an invocable snippet. · b.JSVar(nameOrExpr) — reference a JS variable/expression as a JSFunc argument (don't quote it).b.GetJSValue(expression[, &ptr]) → any — polls until expression is defined (retries through undefined and a thrown error; null returns immediately), then returns it, decoded into a concrete type. The app-state barrier: point it at a global the app writes to prove the browser processed something — but it gates on definedness only, so it's vacuous against an eagerly-created path. Rules, the eager-path fix, and when absence itself is meaningful → flaky-specs §3.Prepare)b.StubRequest(url string|matcher, biloba.StubResponse{Status,Body,Headers}) — the first handler enables interception; unmatched requests pass through.b.AbortRequest(url string|matcher) — fail matching requests (the page's fetch rejects).b.ModifyRequest(url string|matcher) → .WithURL(u).WithMethod(m).WithHeader(n,v).WithBody(b) — continue to the real network, overriding only what you set.b.ModifyResponse(url string|matcher) → .WithStatus(s).WithHeader(n,v).WithBody(b) or .Using(func(biloba.InterceptedResponse) biloba.StubResponse) — rewrite the real response (reads real status/headers/body; heavier — pauses twice). A body Chrome refuses to hand over (a redirect's) or otherwise fails to read is never handed to Using/the static override — Biloba continues it unmodified (or fails the request, for a genuine read failure); Count() still ticks. → debug-failuresCount() reports how many dispatches that handler claimed — *RequestStub/*RequestAbort/*RequestModification/*ResponseModification (plus *ResponseHold below). A snapshot, safe to poll: Eventually(stub.Count).Should(Equal(1)). Assert your handler fired — a typo'd URL otherwise matches nothing, goes straight to the real network, and the spec passes for the wrong reason. Count is a fact about that handler, not the URL: first-match-wins means a handler shadowed by an earlier one stays at 0.Ordered container Prepare() is OncePerOrdered, so handlers accumulate across the Its: an earlier spec's handler permanently claims that URL and a later identical one is silent dead code. → flaky-specs §6Network.setCacheDisabled(true), restored by Prepare()) — a cached response raises no Fetch event and would skip every handler.b.HaveMadeRequest(url string|matcher) — chain .WithMethod(m), .WithStatus(int|matcher), .Failed().b.AllRequests() → Requests snapshot of copies (*Request has .URL/.Method/.Headers/.ResourceType/.Status/.Failure); b.RequestMatching(...) predicate for .Find/.Filter. Status is 0 until the response arrives (and for a request that failed without one); a redirect is one Request per hop, the redirected hop carrying the 3xx. Failure is Chrome's error text (net::ERR_CONNECTION_REFUSED, net::ERR_BLOCKED_BY_CLIENT from AbortRequest); a 404 is a Status, not a Failure. Chrome reports net::ERR_ABORTED for a response whose body the page never reads, so such a request has both. To wait on an outcome, poll HaveMadeRequest(...).WithStatus(...)/.Failed() — a snapshot does not update.b.BeNetworkIdle() — zero in-flight requests at the instant it's polled, no quiet period. Tracks HTTP only (Network.requestWillBeSent/loadingFinished); a long-lived WebSocket does not keep it busy. Requests of a page that navigated away stop counting; Chrome never reports them finished. It passes before your request has started — anchor with Eventually(b).Should(b.HaveMadeRequest(...)) first, then wait for idle.b.HoldResponse(url string|matcher) → *ResponseHoldIntercepts the real response and holds it in flight until you release it (then it passes through unchanged). Builds on ModifyResponse — same tab scoping, same first-match-wins list. Holds every matching response by default. A response whose body can't be read (a redirect's, most commonly) is never held — it counts toward Count/PassedThrough like one that arrived at the Limit, and Await never sees it. The tool for forcing arrival order in optimistic-UI reconciliation; full rules and reasoning (Limit/Release/ReleaseNext semantics, why Count/Release are network facts not app facts, the tab-wide/URL-based sharp edge) → flaky-specs §3.
hold.Await() → InterceptedResponse — blocks until a match is held, returns the oldest one still held. Waiting command: own 30s default, honors WithTimeout/WithContext set on the tab you build the hold from; WithPolling/Immediate are a hard error.hold.Limit(n) → *ResponseHold — hold at most n concurrently; further matches pass straight through untouched (still counted).hold.Release() — terminal: releases everything held and disarms the hold.hold.Release(r) — release just that response; the hold stays armed.hold.ReleaseNext() — release the oldest still-held response and stay armed. Fails the spec when nothing is held.hold.Count() → int — every match intercepted so far, held or passed through. Snapshot, safe to poll.hold.Held() / hold.PassedThrough() → int — split of Count(); both snapshots, safe to poll.Prepare().debug-failuresb.Outline() → string (indented DOM) · b.A11yOutline() → string (accessibility tree: role + name).b.CaptureScreenshot() → []byte (PNG) · b.CaptureImgcatScreenshot() → string · b.CaptureScreenshotToFile(path) → abs path.CaptureOptions: b.Frozen() — the HaveScreenshot freeze (fonts loaded, CSS animations/transitions off, caret hidden; scroll-timeline animations left running) for one capture · b.HideCaret() — only the caret · b.Viewport() — exactly what's on screen; a plain CaptureScreenshot is full-page and re-lays a scrolling document out at its full size, which responsive pages notice; on CaptureScreenshotOf it refuses an element not fully in view · b.Clip(x, y, w, h) — a region of the viewport in CSS px (page captures only; outside the viewport fails).b.CaptureScreenshotOf(selector) · b.CaptureImgcatScreenshotOf(selector) · b.CaptureScreenshotOfToFile(selector, path) — clipped to the first match (any selector; works below the fold and across >>>).b.SetWindowSize(w, h, ...opt) · b.WindowSize(). Device options: b.DeviceScaleFactor(f) · b.Mobile() (honours <meta viewport>; no meta → 980px layout) · b.TouchScreen() (maxTouchPoints, pointer: coarse) · b.Landscape() — all reset with the size. SetWindowSize registers its own DeferCleanup to restore the prior size — don't restore manually, and don't call it from inside another DeferCleanup (Ginkgo forbids nesting). Call it bare in BeforeEach/BeforeAll.b.SetMedia(biloba.Media{ColorScheme: "dark", ReducedMotion: "reduce", Type: "print"}) — emulated CSS media for the tab (and its frames), held across navigations, replaced wholesale by the next call, undone by its own DeferCleanup. HaveScreenshot renders in it; InColorSchemes overrides only the scheme and restores it.b.SetUserAgent(ua) — navigator.userAgent + User-Agent header for documents loaded afterwards (call before Navigate); restored by its own DeferCleanup.DeferCleanup, refused on a frame handle, no poll knobs; Prepare() clears one whose cleanup didn't land:
b.SetGeolocation(biloba.Geolocation{Latitude, Longitude, Accuracy}) · b.ClearGeolocation() — what navigator.geolocation reports; the page also needs the geolocation permission. Out-of-range values fail the spec.b.SetPermissions(origin, map[biloba.Permission]biloba.PermissionState{...}) · b.ResetPermissions() — PermissionGranted/Denied/Prompt for one origin ("" = every origin); calls add up. Constants PermissionGeolocation/Notifications/Camera/Microphone/ClipboardRead/ClipboardWrite; any navigator.permissions.query name works. Scoped to the browser context: spawned tabs share it, NewTab() tabs don't.b.SetLocale("fr-FR") — default locale of Intl/toLocaleString() (not navigator.language or Accept-Language) · b.SetTimezone("Europe/Paris") — IANA name. "" clears; an unknown name fails the spec.b.SetNetworkState(biloba.NetworkState{Offline, Latency, DownloadThroughput, UploadThroughput, ConnectionType}) — replaces the previous state; offline fails requests and sets navigator.onLine false; throughput in bytes/s, 0 = unthrottled · b.SetOffline(bool) keeps the rest · b.NetworkState() → the emulated state (a snapshot; works on a frame handle).b.SetCacheEnabled(bool) — the tab's HTTP cache. Network interception keeps the cache off for the rest of the spec regardless.Date, performance.now, setTimeout/setInterval, requestAnimationFrame, requestIdleCallback, and their clears; not CSS/Web Animations). Per tab and its same-process frames, removed when the spec ends (and by Prepare()), refused on a frame handle. Install before Navigate to cover everything; installed after, timers the page already scheduled stay real. Every document loaded later starts where the clock is. Millisecond resolution.
clock := b.InstallClock(t0) → *Clock, time flowing from t0 at the real rate; a second call on the tab fails · b.Clock() → the installed clock, acting through that view (fails when none).clock.PauseAt(t) — stop at t (ahead: fires each due timer once on the way; behind: moves back, fires nothing) · clock.Resume() — flow again · clock.RunFor(d) — advance d, running every due timer and animation frame in order, each in its own task (promise callbacks run between); waiting command, 10s of real time by default, b.WithTimeout(d).Clock().RunFor(...) for more · clock.FastForward(d) — jump, firing each due timer once · clock.SetFixedTime(t) — pin Date, timers keep running · clock.SetSystemTime(t) — move the time without firing anything; unpins SetFixedTime.This tab's page clock is paused at <t>; ....rec := b.StartScreencast(biloba.ScreencastOptions{Format: "jpeg", Quality: 92, MaxWidth, MaxHeight, EveryNthFrame}) · rec.Stop() → []biloba.ScreencastFrame (Data, Timestamp = when Chrome expects to display the frame — from Chrome 156 about one frame after it was drawn, so the last one can postdate Stop returning — comparable to time.Now(), plus DeviceWidth/DeviceHeight/PageScaleFactor/ScrollOffsetX/ScrollOffsetY/OffsetTop), sorted by Timestamp; Stop again returns the same frames. Frames arrive only when the page draws; window-sized in CSS pixels (device scale factor doesn't enlarge them); held in memory. One per tab (a second start fails); an unstopped recording is stopped by its own DeferCleanup and keeps its frames (Stop afterwards still returns them); no poll knobs. Frame timing is steady only in chrome-headless-shell — full Chrome can reorder, stall, or late-stamp frames.visual-assertionsb.HaveScreenshot(name string, ...ScreenshotOption) — bare matcher; compares the subject against the committed baseline <name>.png. Subject is a selector (element capture, clipped to its box) or the tab b (whole page). Every poll attempt captures and compares afresh, so the poll waits out fonts/ResizeObserver/rAF. name may contain / for subdirectories. Configure the Eventually (a knob on the matcher is a hard error); Gomega's 1s default is usually too short.
Eventually(".card").WithTimeout(10*time.Second).Should(b.HaveScreenshot("card"))
Eventually(b).Should(b.HaveScreenshot("home", b.InColorSchemes("light", "dark")))
ScreenshotOption): b.Mask(selectors...) paints matches flat gray on both sides of the comparison (no-op if nothing matches) · b.Tolerance(fraction) at most fraction (0..1) of pixels may differ · b.ChannelTolerance(delta) a pixel only counts as differing when an R/G/B/A channel is off by more than delta (the antialiasing absorber) · b.Animated() opts out of the automatic animation/transition/caret/smooth-scroll freeze (which reaches open shadow roots, not closed ones) · b.InColorSchemes(schemes...) compares once per emulated prefers-color-scheme, all must match, baseline per scheme <name>-<scheme>.png. Both tolerances default to 0 (exact)../biloba-baselines, BilobaConfigScreenshotBaselinesDir / BILOBA_SCREENSHOT_BASELINES_DIR); the .actual.png/.diff.png a failure writes are gitignored, landing in the failure-screenshots dir. Suite-wide tolerance: BilobaConfigScreenshotTolerance(fraction) / BilobaConfigScreenshotChannelTolerance(delta).BILOBA_UPDATE_SCREENSHOTS=1, which writes baselines and reports in words what changed. Update mode captures until three in a row match before writing (so a write takes ~0.5–2.2s) and warns if the page never settles. The var takes 1/t/true/y/yes/on; an unrecognised value warns. A failed comparison prints a text diagnosis (pixel counts, the changed-region shape, the untouched side) plus the three paths.What SKILL.md sets; muted values are Claude Code's defaults
12 skills in this plugin
/debug-failuresSee why a Go/Ginkgo Biloba spec failed or flaked — the on-failure artifacts (DOM outline + screenshots + poll trajectory of the timed-out read + the visual-regression diagnosis with its .actual.png/.diff.png, the "never settled" warning an update run prints + the detached-node "matched then stopped matching" signal + the occluded-click diagnosis naming what covered the target), how Biloba auto-adapts to humans vs CI vs AI agents, the env vars and config knobs that surface them (BILOBA_SCREENSHOTS_DIR, BILOBA_SCREENSHOT_BASELINES_DIR, BILOBA_UPDATE_SCREENSHOTS, BILOBA_INLINE_SCREENSHOTS, BILOBA_OUTLINE_MAX, BILOBA_INTERACTIVE, BilobaConfig*), attaching app/store state to a failure, headless quirks (stale innerText, unscheduled requestAnimationFrame), and using b.Outline()/b.A11yOutline() to understand why a selector did not match. Use when a browser spec is failing or flaky and you need visibility, or to configure failure output for CI/agents. For *preventing* flakes (single-shot reads, avoiding b.Immediate(), optimistic-UI) see this plugin's flaky-specs skill./explore-unfamiliar-pageOrient to an unfamiliar page, then draft a starter Go/Ginkgo Biloba spec from its DOM outline, accessibility tree, and screenshot. Use when writing browser tests against a URL or fixture you have not seen. Covers the orient-author-cleanup loop and accepts a URL or fixture argument when invoked explicitly.npx claudepluginhub onsi/biloba --plugin biloba-goOther plugins' skills for the same job