page_object v0.4.0 PageObject.Actions.Selectable

A module wrapper for the selectable action macro

Summary

Macros

Defines a module function that can select an option by its label. The function name is derived by action_name

Macros

selectable(action_name, css_selector, opts \\ [])

Defines a module function that can select an option by its label. The function name is derived by action_name.

When scoped to a collection it requires an element be passed to the action.

## Example

  # without a collection
  defmodule MyPage do
    use PageObject

    selectable :hour, "select[name='hour']"
  end

  # click form submit button
  MyPage.hour("11")

  # with a collection
  defmodule MyPage do
    use PageObject

    collection :things, ".thing" do
      selectable :hour, "select[name='hour']"
    end
  end

  # fill select of 0th item in things
  |> MyPage.Things.get(0)
  MyPage.Things.hour("10")