Sha256: aa23891c2412309c0b707061c7e07e8d936f2af7ddb126d09bdea1073982629a

Contents?: true

Size: 1.37 KB

Versions: 18

Compression:

Stored size: 1.37 KB

Contents

module MiniAutobot
  module PageObjects
    module Widgets

      # A widget represents a portion (an element) of a page that is repeated
      # or reproduced multiple times, either on the same page, or across multiple
      # page objects or page modules.
      class Base
        include Utils::Castable
        include Utils::PageObjectHelper
        include Utils::OverlayAndWidgetHelper

        attr_reader :driver, :element, :page

        def initialize(page, element)
          @driver = page.driver
          @page = page
          @element = element
        end

        ## for widgets that include Utils::OverlayAndWidgetHelper
        def page_object
          @page
        end

        attr_reader :driver
        attr_reader :element

        # Explicitly wait for a certain condition to be true:
        #   wait.until { driver.find_element(:css, 'body.tmpl-srp') }
        # when timeout is not specified, default timeout 5 sec will be used
        # when timeout is larger than 15, max timeout 15 sec will be used
        def wait(opts = {})
          if !opts[:timeout].nil? && opts[:timeout] > 15
            puts "WARNING: #{opts[:timeout]} sec timeout is NOT supported by wait method,
                max timeout 15 sec will be used instead"
            opts[:timeout] = 15
          end
          Selenium::WebDriver::Wait.new(opts)
        end

      end

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mini_autobot-0.7.0 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.6.0 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.5.0 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.4.0 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.3.0 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.2.2 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.2.1 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.2.0 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.1.1 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.1.0 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.0.8 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.0.7 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.0.6 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.0.5 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.0.4 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.0.3 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.0.2 lib/mini_autobot/page_objects/widgets/base.rb
mini_autobot-0.0.1 lib/mini_autobot/page_objects/widgets/base.rb