Module: Appom::ElementContainer::ClassMethods
- Defined in:
- lib/appom/element_container.rb
Instance Attribute Summary collapse
-
#mapped_items ⇒ Object
readonly
Returns the value of attribute mapped_items.
Instance Method Summary collapse
-
#add_to_mapped_items(item) ⇒ Object
Add item to @mapped_items array.
-
#element(name, *find_args) ⇒ Object
Declare an element with name and args to find it.
-
#elements(name, *find_args) ⇒ Object
Declare an elements with name and args to find it.
Instance Attribute Details
#mapped_items ⇒ Object (readonly)
Returns the value of attribute mapped_items.
30 31 32 |
# File 'lib/appom/element_container.rb', line 30 def mapped_items @mapped_items end |
Instance Method Details
#add_to_mapped_items(item) ⇒ Object
Add item to @mapped_items array
79 80 81 82 |
# File 'lib/appom/element_container.rb', line 79 def add_to_mapped_items(item) @mapped_items ||= [] @mapped_items << item end |
#element(name, *find_args) ⇒ Object
Declare an element with name and args to find it
element :email, :accessibility_id, 'email_text_field'
appium.io/docs/en/commands/element/find-element/
Element doesn’t support block so that will raise if pass a block when declare
44 45 46 47 48 49 50 51 |
# File 'lib/appom/element_container.rb', line 44 def element(name, *find_args) build(name, *find_args) do |*runtime_args, &block| define_method(name) do raise_if_block(self, name, !block.nil?, :element) find(*merge_args(find_args, runtime_args)) end end end |
#elements(name, *find_args) ⇒ Object
Declare an elements with name and args to find it
elements :contact_cell, :accessibility_id, 'contact_cell'
appium.io/docs/en/commands/element/find-element/
Elements doesn’t support block so that will raise if pass a block when declare
65 66 67 68 69 70 71 72 |
# File 'lib/appom/element_container.rb', line 65 def elements(name, *find_args) build(name, *find_args) do |*runtime_args, &block| define_method(name) do raise_if_block(self, name, !block.nil?, :elements) all(*merge_args(find_args, runtime_args)) end end end |