/biloba-go:xpathfrom biloba-go
Builds XPath selectors using Biloba's Go b.XPath() mini-DSL with tag/id/class/text/attribute predicates, boolean logic, tree navigation, and indexing. Useful when CSS or semantic locators can't express axis/relationship/ordinal queries.
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.
XPath is the rare power tool, reached for after CSS and semantic locators (write-tests). Use it for axis/relationship/ordinal queries those can't express — an ancestor, a following-sibling, "the ul that has a child li saying X" — or exact text()-node matching. It is native and fast but verbose, and it does not pierce shadow roots or iframes (CSS >>> and locators do).
b.XPath() returns type XPath string — chainable, printable (fmt.Println(b.XPath("div").WithClass("c"))), and accepted as the selector by any Biloba action or matcher. Docs: https://onsi.github.io/biloba/#the-xpath-dsl. Sibling skills are named here without a prefix; invoke one with the same plugin prefix you loaded this skill under.
b.XPath() // //* — any element
b.XPath("div") // //div — by tag
b.XPath("//div[@id='x']") // verbatim — anything starting with / or ./
b.XPath().WithID("submit") // @id = 'submit'
b.XPath().WithClass("red").WithClass("lg") // both classes
b.XPath("button").WithText("Next") // exact full text
b.XPath("li").WithTextStartsWith("Chapter")
b.XPath("q").WithTextContains("dream")
b.XPath("button").HasAttr("disabled") // attribute present
b.XPath("input").WithAttr("type", "text") // attribute equals
b.XPath("input").WithAttrStartsWith("name", "astro")
b.XPath().WithAttrContains("name", "bueller")
b.XPredicate(), not b.XPath()The #1 gotcha: And/Or/Not take predicates.
// a button labelled "Add Comment" that is not disabled
b.XPath("button").WithText("Add Comment").Not(b.XPredicate().HasAttr("disabled"))
// a red Error div or an orange Warning div, but not a fire-drill
b.XPath("div").Or(
b.XPredicate().And(b.XPredicate().WithClass("red"), b.XPredicate().WithText("Error")),
b.XPredicate().And(b.XPredicate().WithClass("orange"), b.XPredicate().WithText("Warning")),
).Not(b.XPredicate().HasAttr("fire-drill"))
b.XPath("div").WithClass("comments").Child() // any direct child
b.XPath("div").WithClass("comments").Child("p") // direct <p> children
b.XPath("div").WithID("top").Descendant("li") // any-depth <li>
b.XPath("div").WithClass("comments").Parent()
b.XPath("div").WithID("bottom").Ancestor("section").WithClass("outer")
b.XPath("li").WithClass("red").FollowingSibling("li").WithClass("blue")
b.XPath("li").WithClass("red").PrecedingSibling()
Ancestor is ancestor-or-self — a matching element counts as its own ancestor. Use AncestorNotSelf(tag) (plain ancestor::) when you need a strict ancestor. DescendantNotSelf(tag) is the matching descendant:: form.
Every step can be refined further with the predicate methods: .Child("p").WithClass("highlight").WithText("User").
b.RelativeXPath()WithChildMatching takes a relative (./) predicate:
// the <ul> that has a child <li> with text "igloo"
b.XPath("ul").WithChildMatching(b.RelativeXPath("li").WithText("igloo"))
b.XPath("ul").Nth(2) // the 2nd <ul> (1-based)
b.XPath("ul").Nth(2).Descendant("li").Last() // its last <li>
someList.First()
The DSL returns a string, so build a base once and extend it:
users := b.XPath("div").WithID("user-list").Descendant()
Eventually(users.WithText("Sally")).Should(b.HaveClass("online"))
Eventually(users.WithText("Jane")).Should(b.HaveClass("online"))
Prefer the locator engine (write-tests): b.ByText("Submit") / b.ByTextContains("Welcome") match visible text; b.ByRole("button").WithName("Save") and b.ByLabel("Email") cover role and label. Locators compose (.ContainingText/.Containing/.And/.Or/.Within/.Nth, all accepting any selector) and pierce open shadow roots automatically, which XPath cannot. Use the DSL's WithText only to scope an exact text() match to a tag: b.XPath("button").WithText("Submit").
XPath crosses neither shadow DOM nor iframe boundaries — >>> is CSS-only. For those, use a CSS selector with >>>, or a semantic locator. For a cross-origin iframe, build the XPath on a frame handle (frame := b.Frame(...), then frame.XPath(...)) — nothing crosses into it from the page.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub onsi/biloba --plugin biloba-go12 skills in this plugin
/apiOne-line reference for every Biloba Go method and matcher, grouped by area — selectors/locators, lifecycle, poll-config (WithTimeout/WithPolling/WithContext/Immediate), capturing a matcher's observed value (.Capture), navigation (GetLocation/GetTitle), cookies/storage, tabs, cross-origin iframes (b.Frame frame handles), DOM existence/visibility/contents/properties/forms, clicking and interactions (incl. drag/scroll/tap/modifiers/text-selection), realistic mode, keyboard, uploads, element JS, dialogs, downloads, arbitrary JS (incl. the GetJSValue app-state barrier), network stubbing/aborting/modifying/observing/holding (HoldResponse + Limit/ReleaseNext), screenshots/screencasts/outline/window, the page clock (InstallClock/Clock + PauseAt/Resume/RunFor/FastForward/SetFixedTime/SetSystemTime), and visual regression (HaveScreenshot + Mask/Tolerance/ChannelTolerance/Animated/InColorSchemes). Use to look up the exact Go method or matcher name and shape. Methods marked (dual) poll until they succeed when fully applied and return a pollable matcher when under-applied./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./flake-huntRun a flake hunt on a Biloba Ginkgo suite — run the whole browser suite many times (60 by default), every run to completion with its own JSON report, then read each spec's failure rate, the seeds, and Biloba's failure evidence out of those reports instead of re-running. Covers the hunt script (compile once, --procs at the measured knee, --randomize-all, --poll-progress-after, a per-run BILOBA_SCREENSHOTS_DIR), why --repeat and --until-it-fails can't measure a rate, what keeps a hunt a valid measurement (one hunt at a time on an idle machine, nothing editing the tree, focused hunts for iterating only, stale visual baselines), how many clean runs it takes to call a flake dead, reading the results (one systemic race behind many names, wedges, a long tail that clusters by run), and the performance record a hunt produces (spec timing, parallel efficiency, per-spec cost, drift between hunts). Use before declaring a flake fixed, after changing shared test helpers or fixtures, at the end of a batch of work, or to measure a suite's performance./flaky-specsDiagnose and prevent flaky Go/Ginkgo Biloba specs — specs that pass locally but fail in CI, fail intermittently under `-p` or load, or fail somewhere other than the line that is actually wrong. Biloba polls by default, so the headline rule is "don't reach for b.Immediate()". Covers the residual smells — single-shot `b.Run(expr,&x)` reads and gate-then-re-read pairs (fix with .Capture); the non-polling SendKeysToWindowImmediately and `*Immediately` verbs; optimistic-UI and server-reconciliation traps (barrier on app state with b.GetJSValue, force the arrival order with b.HoldResponse + Limit/ReleaseNext); async-settling geometry, layout, and document-order reads; AllowMissing for properties absent on the element type; network handlers accumulating across an Ordered container; vacuous assertions that can never fail (an unresolved locator scope, BeNetworkIdle before the request starts, an empty Current*ForEach under a negation, a visual baseline written without ever being reviewed, a screenshot tolerance widened until nothing can fail, BILOBA_UPDATE_SCREENSHOTS left set in CI); gating on a DOM anchor instead of the URL; never waiting out a clock for a fact you can observe (durations clustered at one timer's period give it away); and timer-driven UI (debounces, countdowns, expiries) taken off real time with the page clock (b.InstallClock, PauseAt/RunFor/FastForward), including why a poll never advances a paused clock. Use when a browser spec is flaky, nondeterministic, order-dependent, load-sensitive, or CI-only, or when reviewing a suite for latent races./look-at-pagesLook at your own UI while you iterate on it, with Go/Ginkgo Biloba — a throwaway spec that screenshots a page across colour schemes (light/dark via b.SetMedia) and viewport sizes (phone via b.SetWindowSize + b.Mobile()/b.TouchScreen()), plus the text views an agent can read without an image (b.Outline, b.A11yOutline, GetBoundingBox, GetComputedStyle, AllConsoleMessages/AllPageErrors), the states worth capturing (focus, open menus, dialogs, CSS :hover via b.Realistic(), error states via StubResponse, long content), and turning what you saw into assertions (Encloses and the other layout matchers, HaveScreenshot with InColorSchemes). Use when asked to look at, review, or screenshot a page or design (light/dark, phone/desktop) rather than to test it. For drafting a first spec against a page you haven't seen, see explore-unfamiliar-page.Other plugins' skills for the same job