Class: ChromeInterface

Inherits:
BaseInterface show all
Defined in:
lib/rutl/interface/chrome_interface.rb

Overview

Small interface for Chrome browser.

Constant Summary

Constants included from Utilities

Utilities::DEFAULT_TIMEOUT, Utilities::POLL_SLEEP_TIME

Instance Attribute Summary

Attributes inherited from BaseInterface

#driver, #pages

Instance Method Summary collapse

Methods inherited from BaseInterface

#find_page, #find_state, #goto, #method_missing, #quit, #respond_to_missing?, #wait_for_transition

Methods included from Utilities

#await, #class_info, #location, #page?, #raise_if_not_page

Constructor Details

#initializeChromeInterface

rubocop:disable Metrics/MethodLength



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rutl/interface/chrome_interface.rb', line 9

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BaseInterface

Instance Method Details

#current_pageObject

rubocop:enable Metrics/MethodLength



26
27
28
29
30
31
# File 'lib/rutl/interface/chrome_interface.rb', line 26

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