page_object v0.4.0 PageObject.Queries.Text

A module wrapper for the text query macro

Summary

Macros

Defines a module function that queries the text value of an element on an html page. The function name is derived by name. When scoped to a collection the function takes an element as an argument

Macros

text(name, css_selector, opts \\ [])

Defines a module function that queries the text value of an element on an html page. The function name is derived by name. When scoped to a collection the function takes an element as an argument.

## Example

  #not in a collection
  defmodule MyPage do
    use PageObject

    text :heading, "h2"
  end

  # queries the text value of `h2` on the current page
  MyPage.heading
  #in a collection
  defmodule MyPage do
    use PageObject

    collection :things, item_scope: ".thing" do
      text :heading, "h2"
    end
  end

  # queries the text value of the 0th ".thing h2"
  MyPage.Things.get(0)
  |> MyPage.Things.heading