page_object v0.4.0 PageObject.Queries.Attribute
A module wrapper for the attribute query macro
Summary
Macros
Defines a module function that queries the attribute 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
Defines a module function that queries the attribute 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
attribute :email_placeholder, "placeholder", "input[type='email']"
end
# queries the value of placeholder attribute on `input[type='email']` on the current page
MyPage.email_placeholder
#in a collection
defmodule MyPage do
use PageObject
collection :things, item_scope: ".thing" do
attribute :email_placeholder, "placeholder", "input[type='email']"
end
end
# queries the value of the placeholder attribute of the 0th ".thing input[type='email']"
MyPage.Things.get(0)
|> MyPage.Things.email_placeholder