Sha256: 74980df28978058d0d9e03286596a8c9e01f0877f741f13f6f2c5960d9a9a2f9

Contents?: true

Size: 963 Bytes

Versions: 2

Compression:

Stored size: 963 Bytes

Contents

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

#
# Small interface for Chrome browser.
#
# TODO: Probably the current_page() implementation should move up to base.
#
class ChromeInterface < BaseInterface
  def initialize(pages:)
    @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 'true' == ENV['TRAVIS']
      options.add_argument('--disable-gpu')
      options.add_argument('--headless ')
      options.add_argument('--no-sandbox')
    end
    @driver = Selenium::WebDriver.for :chrome, options: options
    super
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rutl-0.1.2 lib/rutl/interface/chrome_interface.rb
rutl-0.1.1 lib/rutl/interface/chrome_interface.rb