class AutomationHelpers::Drivers::V4::Remote
{AutomationHelpers::Drivers::V4::Remote}
The Remote
Driver that will connect to a dockerised self-hosted grid Expects the grid to be live and accepting node requests
Attributes
browser[R]
Public Class Methods
new(browser)
click to toggle source
#### Initial setup options
-
browser (required) - When instantiating, the first argument must be the symbol that represents what browser to use
-
**ENV** (required) - The environment variable HUB_URL must be set to the actively running dockerised grid (By default this should be
http://hub:4444/wd/hub
)
# File lib/automation_helpers/drivers/v4/remote.rb, line 24 def initialize(browser) @browser = browser end
Public Instance Methods
register()
click to toggle source
@return [Nil]
Register a new driver with the default selenium name for use in a (localised), remote grid setup
# File lib/automation_helpers/drivers/v4/remote.rb, line 31 def register Capybara.register_driver :selenium do |app| Capybara::Selenium::Driver.new( app, browser: :remote, capabilities: [browser_capabilities, options], url: hub_url ) end end
Private Instance Methods
browser_capabilities()
click to toggle source
# File lib/automation_helpers/drivers/v4/remote.rb, line 44 def browser_capabilities raise ArgumentError, 'You must use a supported browser' unless supported_browser? Capabilities.for(browser) end
hub_url()
click to toggle source
# File lib/automation_helpers/drivers/v4/remote.rb, line 54 def hub_url ENV['HUB_URL'] end
options()
click to toggle source
# File lib/automation_helpers/drivers/v4/remote.rb, line 50 def options Options.for(browser) end
supported_browser?()
click to toggle source
# File lib/automation_helpers/drivers/v4/remote.rb, line 58 def supported_browser? %i[chrome firefox].include?(browser) end