Public Vars

Back

query (clj)

(source)

function

(query driver q) (query driver q & more)
Use `driver` to find and return the first element on current page matching `q`. Query `q` can be: - `:active` the current active element - a keyword to find element by it's ID attribute: - `:my-id` - (use `{:id "my-id"}` for ids that cannot be represented as keywords) - an XPath expression: - `".//input[@id='uname']"` - a map with either `:xpath` or `:css`: - `{:xpath ".//input[@id='uname']"`}` - `{:css "input#uname[name='username']"}` - any other map is converted to an XPath expression: - `{:tag :div}` - is equivalent to XPath: `".//div"` - multiple of the above (wrapped in a vector or not). The result of each expression is fed into the next. - `{:tag :div} ".//input[@id='uname']"` - `[{:tag :div} ".//input[@id='uname']"]` Returns the found element's unique identifier, or throws when not found. See [Selecting Elements](/doc/01-user-guide.adoc#querying) for more details.

Examples