page_object v0.4.0 PageObject.Queries.IsPresent

A module wrapper for the is_present? query macro

Summary

Macros

Defines a module function that determines the presence 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

is_present?(name, css_selector, opts \\ [])

Defines a module function that determines the presence 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

    is_present? :warning_is_present?, ".warning"
  end

  # returns whether an element with class "warning" is present on the page
  MyPage.warning_is_present?
  #in a collection
  defmodule MyPage do
    use PageObject

    collection :things, item_scope: ".thing" do
      is_present? :error_is_present?, ".error"
    end
  end

  # returns whether an element with class "error" exists within the 0th ".thing"
  MyPage.Things.get(0)
  |> MyPage.Things.error_is_present?