Module: OnlyofficeWebdriverWrapper::ChromeHelper
- Includes:
- ChromeVersionHelper
- Included in:
- WebDriver
- Defined in:
- lib/onlyoffice_webdriver_wrapper/helpers/chrome_helper.rb
Overview
Class for working with Chrome
Constant Summary collapse
- DEFAULT_CHROME_SWITCHES =
Returns list of default Chrome command line switches.
%w[--kiosk-printing --disable-gpu --disable-popup-blocking --disable-infobars --no-sandbox test-type].freeze
Instance Method Summary collapse
-
#chrome_service ⇒ Selenium::WebDriver::Chrome::Service
Instance of Chrome Service object.
-
#start_chrome_driver ⇒ Webdriver::Chrome
Chrome webdriver.
Methods included from ChromeVersionHelper
#chrome_version, #chromedriver_path, #unknown_chrome_version
Instance Method Details
#chrome_service ⇒ Selenium::WebDriver::Chrome::Service
Returns Instance of Chrome Service object.
19 20 21 |
# File 'lib/onlyoffice_webdriver_wrapper/helpers/chrome_helper.rb', line 19 def chrome_service @chrome_service ||= Selenium::WebDriver::Chrome::Service.new(path: chromedriver_path) end |
#start_chrome_driver ⇒ Webdriver::Chrome
Returns Chrome webdriver.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/onlyoffice_webdriver_wrapper/helpers/chrome_helper.rb', line 24 def start_chrome_driver prefs = { download: { 'prompt_for_download' => false, 'default_directory' => download_directory }, profile: { 'default_content_setting_values' => { 'automatic_downloads' => 1 } }, credentials_enable_service: false } switches = add_useragent_to_switches(DEFAULT_CHROME_SWITCHES) = Selenium::WebDriver::Chrome::Options.new(args: switches, prefs: prefs) .add_argument("--unsafely-treat-insecure-origin-as-secure=#{ENV['PortalIP']}") if ENV['PortalIP'] = { options: , service: chrome_service } driver = Selenium::WebDriver.for :chrome, maximize_chrome(driver) driver end |