Class: Selenium::WebDriver::Driver

Inherits:
Object
  • Object
show all
Defined in:
lib/webdriver-firefox/no_lock_driver.rb

Class Method Summary collapse

Class Method Details

.for(browser, opts = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/webdriver-firefox/no_lock_driver.rb', line 7

def for(browser, opts = {})
  listener = opts.delete(:listener)

  bridge = case browser
           when :firefox, :ff
             Firefox::Bridge.new(opts)
           when :firefox_tddium
             pool = ::NoLockFirefox::PortPool.new
             opts[:port] = pool.find_free_port
             ::NoLockFirefox::NoLockFirefoxBridge.new(opts)
           when :remote
             Remote::Bridge.new(opts)
           when :ie, :internet_explorer
             IE::Bridge.new(opts)
           when :chrome
             Chrome::Bridge.new(opts)
           when :android
             Android::Bridge.new(opts)
           when :iphone
             IPhone::Bridge.new(opts)
           when :opera
             Opera::Bridge.new(opts)
           when :phantomjs
             PhantomJS::Bridge.new(opts)
           when :safari
             Safari::Bridge.new(opts)
           else
             raise ArgumentError, "unknown driver: #{browser.inspect}"
           end

  bridge = Support::EventFiringBridge.new(bridge, listener) if listener

  new(bridge)
end