Sha256: 5afbe8b0e3e22ec1001f376889492518e3bc320213a01694a0de988a5df9d92b

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'selenium-webdriver'
require 'rutl/interface/base'

module RUTL
  module Interface
    #
    # Small interface for Chrome browser.
    #
    class Chrome < Base
      # rubocop:disable Metrics/MethodLength
      def initialize
        @logged_in = true
        options = Selenium::WebDriver::Chrome::Options.new
        options.add_argument('--ignore-certificate-errors')
        options.add_argument('--disable-popup-blocking')
        options.add_argument('--disable-translate')
        # Run headless on TravisCI
        if ENV['TRAVIS'] == 'true'
          options.add_argument('--disable-gpu')
          options.add_argument('--headless ')
          options.add_argument('--no-sandbox')
        end
        @driver = Selenium::WebDriver.for :chrome, options: options
        super
      end
      # rubocop:enable Metrics/MethodLength

      def current_page
        url = @driver.current_url
        page = find_page(url)
        raise "PAGE NOT FOUND: #{url}, PAGES: #{@pages}" unless page
        page
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rutl-0.6.0 lib/rutl/interface/chrome.rb