Sha256: 9b2792e9879a5a223a24cdb3aaaf45aeb47d43ca97c6d8826ef9f2e495a6e203

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

module Browsery
  module PageObjects
    class Section
      extend ElementContainer

      attr_reader :root_element, :parent

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

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

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

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

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
browsery-0.5.2 lib/browsery/page_objects/section.rb
browsery-0.5.0 lib/browsery/page_objects/section.rb