lib/selenium/webdriver/ie/bridge.rb in selenium-webdriver-0.1.2 vs lib/selenium/webdriver/ie/bridge.rb in selenium-webdriver-0.1.3.dev
- old
+ new
@@ -6,40 +6,51 @@
# @api private
#
class Bridge < Remote::Bridge
- HOST = "localhost"
-
+ HOST = Platform.localhost
DEFAULT_PORT = 5555
DEFAULT_TIMEOUT = 30
def initialize(opts = {})
- timeout = opts[:timeout] || DEFAULT_TIMEOUT
- @port = opts[:port] || DEFAULT_PORT
- @speed = opts[:speed] || :fast
+ timeout = opts.delete(:timeout) { DEFAULT_TIMEOUT }
+ port = opts.delete(:port) { DEFAULT_PORT }
+ http_client = opts.delete(:http_client)
- @server_pointer = Lib.start_server @port
+ unless opts.empty?
+ raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
+ end
- unless SocketPoller.new(HOST, @port, timeout).connected?
- raise "unable to connect to IE server within #{timeout} seconds"
+ @server = Server.new
+ @port = @server.start Integer(port)
+
+ host = Platform.localhost
+ unless SocketPoller.new(host, @port, timeout).connected?
+ raise Error::WebDriverError, "unable to connect to IE server within #{timeout} seconds"
end
- super(:url => "http://#{HOST}:#{@port}",
- :desired_capabilities => :internet_explorer)
+ remote_opts = {
+ :url => "http://#{host}:#{@port}",
+ :desired_capabilities => :firefox
+ }
+
+ remote_opts.merge!(:http_client => http_client) if http_client
+
+ super(remote_opts)
end
def browser
:internet_explorer
end
def driver_extensions
- []
+ [DriverExtensions::TakesScreenshot, DriverExtensions::HasInputDevices]
end
def quit
super
- Lib.stop_server(@server_pointer)
+ @server.stop
nil
end
end # Bridge