wallaby v0.9.0 Wallaby.Node.Query
Provides the query DSL.
Queries are used to locate and retrieve DOM nodes. The standard method for querying is css selectors:
visit("/page.html")
|> find("#main-page .dashboard")
If more complex querying is needed then its possible to use XPath:
find(page, {:xpath, "//input"})
By default finders only work with elements that would be visible to a real user.
Scoping
Finders can also be chained together to provide scoping:
visit("/page.html")
|> find(".users")
|> find(".user", count: 3)
|> List.first
|> find(".user-name")
Form elements
There are several custom finders for locating form elements. Each of these allows finding by their name, id text, or label text. This allows for more robust querying and decouples the query from presentation selectors like css classes.
Query Options
All of the query operations accept the following options:
:count
- The number of elements that should be found (default: 1).:visible
- Determines if the query should return only visible elements (default: true).:text
- Text that should be found inside the element.
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
Builds a query struct to send to webdriver
Finds a button by its id, name, or label text
Finds a checkbox field by its id, name, or label text
Locates a text field or textarea by its id, name, placeholder, or label text
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
Finds a link field by its id, name, or text. If the link contains an image then it can find the link by the image’s alt text
Finds an option field by its option text
Locates a radio button by its id, name, or label text
Finds a select field by its id, name, or label text
Types
Functions
Specs
all(parent, locator, opts) :: [Wallaby.Node.t]
Finds all of the DOM nodes that match the css selector. If no elements are found then an empty list is immediately returned.
Options
See the “Query Options” section in the module documentation
Builds a query struct to send to webdriver.
Finds a button by its id, name, or label text.
Options
See the “Query Options” section in the module documentation
Finds a checkbox field by its id, name, or label text.
Options
See the “Query Options” section in the module documentation
Locates a text field or textarea by its id, name, placeholder, or label text.
Options
See the “Query Options” section in the module documentation
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.
Options
See the “Query Options” section in the module documentation
Finds a link field by its id, name, or text. If the link contains an image then it can find the link by the image’s alt text.
Options
See the “Query Options” section in the module documentation
Finds an option field by its option text.
Options
See the “Query Options” section in the module documentation
Locates a radio button by its id, name, or label text.
Options
See the “Query Options” section in the module documentation