Method: PageObject::Accessors#paragraph
- Defined in:
- lib/page-object/accessors.rb
#paragraph(name, identifier = {:index => 0}, &block) ⇒ Object
adds three methods - one to retrieve the text of a paragraph, another to retrieve a paragraph element, and another to check the paragraph’s existence.
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 |
# File 'lib/page-object/accessors.rb', line 935 def paragraph(name, identifier={:index => 0}, &block) define_method(name) do return platform.paragraph_text_for identifier.clone unless block_given? self.send("#{name}_element").text end define_method("#{name}_element") do return call_block(&block) if block_given? platform.paragraph_for(identifier.clone) end define_method("#{name}?") do return call_block(&block).exists? if block_given? platform.paragraph_for(identifier.clone).exists? end alias_method "#{name}_paragraph".to_sym, "#{name}_element".to_sym end |