wallaby v0.3.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. By default only nodes that are visible on the page are returned
Matches the Node’s content with the provided text
Searches for CSS on the page
Searches for css that should not be on the page
Matches the Node’s value with the provided value
Selects an option from a select box. Searches for the select box by id, name or label, then finds the option by visible text
Gets the selected value of the element
Checks if the node has been selected. Alias for checked?(node)
Gets the Node’s text value
Unchecks a checkbox
Checks if the node is visible on the page
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. By default only nodes that are visible on the page are returned.
Selections can be scoped by providing a Node as the locator for the query.
Matches the Node’s content with the provided text.
Searches for css that should not be on the page
Specs
has_value?(t, any) :: boolean
Matches the Node’s value with the provided value.
Specs
select(locator, String.t, [{:option, query}]) :: Wallaby.Session.t
Selects an option from a select box. Searches for the select box by id, name or label, then finds the option by visible text.
The specific node for the select box can also be passed in directly.
Specs
selected(t) :: any
Gets the selected value of the element.
For Checkboxes and Radio buttons it returns the selected option.
Specs
selected?(t) :: boolean
Checks if the node has been selected. Alias for checked?(node)