wallaby v0.1.0 Wallaby.Node
Common functionality for interacting with DOM nodes.
Nodes can be found by executing css queries against a page:
visit("/page.html")
|> find("#main-page .dashboard")
Finders can also be chained together to provide scoping:
visit("/page.html")
|> find(".users")
|> find(".user", count: 3)
|> List.first
|> find(".user-name")
|> text
Summary
Functions
Finds all of the DOM nodes that match the css selector. If no elements are found then an empty list is immediately returned
Gets the value of the nodes attribute
Marks a checkbox as “checked”
Checks if the node has been selected
Chooses a radio button
Clears an input field. Input nodes are looked up by id, label text, or name. The node can also be passed in directly
Clicks a node
Fills in a “fillable” node with text. Input nodes are looked up by id, label text, or name. The specific node can also be passed in directly
Finds a specific DOM node on the page based on a css selector. Blocks until it either finds the node or until the max time is reached. By default only 1 node is expected to match the query. If more nodes are present then a count can be specified
Matches the Node’s content with the provided text
Matches the Node’s value with the provided value
Gets the selected value of the element
Gets the Node’s text value
Unchecks a checkbox
Types
Functions
Finds all of the DOM nodes that match the css selector. If no elements are found then an empty list is immediately returned.
Specs
choose(Wallaby.Session.t, query) :: Wallaby.Session.t
Chooses a radio button.
Specs
clear(Wallaby.Session.t, query) :: Wallaby.Session.t
Clears an input field. Input nodes are looked up by id, label text, or name. The node can also be passed in directly.
Specs
fill_in(locator, query, [{:with, String.t}]) :: Wallaby.Session.t
Fills in a “fillable” node with text. Input nodes are looked up by id, label text, or name. The specific node can also be passed in directly.
Finds a specific DOM node on the page based on a css selector. Blocks until it either finds the node or until the max time is reached. By default only 1 node is expected to match the query. If more nodes are present then a count can be specified.
Selections can be scoped by providing a Node as the locator for the query.
Matches the Node’s content with the provided text.
Specs
has_value?(t, any) :: boolean
Matches the Node’s value with the provided value.
Specs
selected(t) :: any
Gets the selected value of the element.
For Checkboxes and Radio buttons it returns the selected option.