Sha256: 1d3326760688d7126405eba5339736e906b657718a6a319a11e4c887deb6046f
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
module Selenium module WebDriver module Chrome # @api private class Bridge < Remote::Bridge def initialize(opts = {}) http_client = opts.delete(:http_client) switches = opts.delete(:switches) native_events = opts.delete(:native_events) verbose = opts.delete(:verbose) profile = opts.delete(:profile) unless opts.empty? raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}" end caps = Remote::Capabilities.chrome if switches unless switches.kind_of? Array raise ArgumentError, ":switches must be an Array of Strings" end caps.merge! 'chrome.switches' => switches.map { |e| e.to_s } end caps.merge! 'chrome.binary' => Chrome.path if Chrome.path caps.merge! 'chrome.nativeEvents' => true if native_events caps.merge! 'chrome.verbose' => true if verbose caps.merge! 'chrome.profile' => profile.as_json['zip'] if profile @service = Service.default_service @service.start remote_opts = { :url => @service.uri, :desired_capabilities => caps } remote_opts.merge!(:http_client => http_client) if http_client super(remote_opts) end def browser :chrome end def driver_extensions [ DriverExtensions::TakesScreenshot, DriverExtensions::HasInputDevices ] end def capabilities @capabilities ||= Remote::Capabilities.chrome end def quit super ensure @service.stop end end # Bridge end # Chrome end # WebDriver end # Selenium
Version data entries
3 entries across 3 versions & 1 rubygems