Class: Pagetience::Platform::PageObjectGem
- Inherits:
-
Object
- Object
- Pagetience::Platform::PageObjectGem
- Defined in:
- lib/pagetience/platforms/page-object-gem.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#page_object ⇒ Object
readonly
Returns the value of attribute page_object.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(page) ⇒ PageObjectGem
constructor
A new instance of PageObjectGem.
- #is_element_present?(sym) ⇒ Boolean
- #underlying_element_for(sym) ⇒ Object
Constructor Details
#initialize(page) ⇒ PageObjectGem
Returns a new instance of PageObjectGem.
21 22 23 24 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 21 def initialize(page) @page_object = page @browser = @page_object.browser end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
19 20 21 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 19 def browser @browser end |
#page_object ⇒ Object (readonly)
Returns the value of attribute page_object.
19 20 21 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 19 def page_object @page_object end |
Class Method Details
.init(base, *args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 5 def init(base, *args) args.flatten! if args base.class.send(:define_method, :visit) do args[1] || false end base.instance_eval do PageObject.instance_method(:initialize).bind(self).call(base.browser, visit) end self.new base end |
Instance Method Details
#is_element_present?(sym) ⇒ Boolean
30 31 32 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 30 def is_element_present?(sym) @page_object.send("#{sym}_element").visible? end |
#underlying_element_for(sym) ⇒ Object
26 27 28 |
# File 'lib/pagetience/platforms/page-object-gem.rb', line 26 def (sym) @page_object.send("#{sym}_element").element end |