Class: Browsery::PageObjects::Section

Inherits:
Object
  • Object
show all
Extended by:
ElementContainer
Includes:
Utils::PageObjectHelper
Defined in:
lib/browsery/page_objects/section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ElementContainer

add_to_mapped_items, element, elements, section, sections

Methods included from Utils::PageObjectHelper

#connector_is_saucelabs?, #current_page, #is_element_present?, #is_element_present_and_displayed?, #json_save_to_ever_failed, #page, #print_sauce_link, #put_value, #read_yml, #retry_with_count, #take_screenshot, #teardown, #update_sauce_session_name, #update_sauce_session_status, #visual_regression, #wait_for_attribute_to_have_value, #wait_for_element_to_be_present, #wait_for_element_to_display, #with_url_change_wait

Constructor Details

#initialize(parent, root_element) ⇒ Section

Returns a new instance of Section.



9
10
11
12
13
# File 'lib/browsery/page_objects/section.rb', line 9

def initialize(parent, root_element)
  @parent = parent
  @root_element = root_element
  # Browsery.within(@root_element) { yield(self) } if block_given?
end

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent.



7
8
9
# File 'lib/browsery/page_objects/section.rb', line 7

def parent
  @parent
end

#root_elementObject (readonly)

Returns the value of attribute root_element.



7
8
9
# File 'lib/browsery/page_objects/section.rb', line 7

def root_element
  @root_element
end

Instance Method Details

#find_all(how, what) ⇒ Object



27
28
29
# File 'lib/browsery/page_objects/section.rb', line 27

def find_all(how, what)
  root_element.all(how, what)
end

#find_first(how, what) ⇒ Object



23
24
25
# File 'lib/browsery/page_objects/section.rb', line 23

def find_first(how, what)
  root_element.find_element(how, what)
end

#parent_pageObject



15
16
17
18
19
20
21
# File 'lib/browsery/page_objects/section.rb', line 15

def parent_page
  candidate_page = parent
  until candidate_page.is_a?(Browsery::PageObjects::Base)
    candidate_page = candidate_page.parent
  end
  candidate_page
end