lib/selenium/webdriver/phantomjs/bridge.rb in selenium-webdriver-3.0.0.beta3.1 vs lib/selenium/webdriver/phantomjs/bridge.rb in selenium-webdriver-3.0.0.beta4.0
- old
+ new
@@ -24,31 +24,20 @@
# @api private
#
class Bridge < Remote::Bridge
def initialize(opts = {})
- http_client = opts.delete(:http_client)
- caps = opts.delete(:desired_capabilities) { Remote::Capabilities.phantomjs }
+ port = opts.delete(:port) || Service::DEFAULT_PORT
+ opts[:desired_capabilities] ||= Remote::Capabilities.phantomjs
- if opts.key?(:url)
- url = opts.delete(:url)
- else
- args = opts.delete(:args) || caps['phantomjs.cli.args']
-
- @service = Service.new(PhantomJS.path, Service::DEFAULT_PORT, *args)
+ unless opts.key?(:url)
+ args = opts.delete(:args) || opts[:desired_capabilities]['phantomjs.cli.args']
+ @service = Service.new(PhantomJS.path, port, *args)
@service.start
-
- url = @service.uri
+ opts[:url] = @service.uri
end
- remote_opts = {
- url: url,
- desired_capabilities: caps
- }
-
- remote_opts[:http_client] = http_client if http_client
-
- super(remote_opts)
+ super(opts)
end
def browser
:phantomjs
end