Sha256: 00baf1a32ab37ebe91f0d558b42a2b6472183b9396e5cb0310ee72d0913f8539

Contents?: true

Size: 953 Bytes

Versions: 3

Compression:

Stored size: 953 Bytes

Contents

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

#
# Small interface for Chrome browser.
#
class ChromeInterface < BaseInterface
  # 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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rutl-0.3.0 lib/rutl/interface/chrome_interface.rb
rutl-0.2.1 lib/rutl/interface/chrome_interface.rb
rutl-0.2.0 lib/rutl/interface/chrome_interface.rb