Geb (pronounced “jeb”)

very groovy browser automation… web testing, screen scraping and more

Navigating Content

Geb takes inspiration from jQuery to provide a concise and effective way to get at content. This is called the Navigator API.

The dollar function can be used anywhere to select content based on CSS selectors, attribute matchers and/or indexes.

// CSS 3 selectors
$("div.some-class p:first[title='something']")

// Find via index and/or attribute matching
$("h1", 2, class: "heading")
$("p", name: "description")
$("ul.things li", 2)

// 'text' is special attribute for the element text content
$("h1", text: "All about Geb")

// Use builtin matchers and regular expressions
$("p", text: contains("Geb"))
$("input", value: ~/\d{3,}-\d{3,}-\d{3,}/)

// Chaining

Form Control Shortcuts

Geb has handy shortcuts for reading and writing form control values.

assert $("form").name == "Jeb"
$("form").name = "Geb"
assert $("form").name == "Geb"

See the manual section on content navigation for more information.