Method: Selenium::WebDriver.for

Defined in:
lib/selenium/webdriver.rb

.for(browser) ⇒ Driver .for(browser, opts) ⇒ Driver

Create a new Driver instance with the correct bridge for the given browser

One special argument is not passed on to the bridges, :listener. You can pass a listener for this option to get notified of WebDriver events. The passed object must respond to #call or implement the methods from AbstractEventListener.

Examples:


WebDriver.for :firefox, profile: 'some-profile'
WebDriver.for :firefox, profile: Profile.new
WebDriver.for :remote,  url: "http://localhost:4444/wd/hub", capabilities: caps

Overloads:

  • .for(browser) ⇒ Driver

    Parameters:

    • browser (:ie, :internet_explorer, :edge, :remote, :chrome, :firefox, :ff, :safari)

      The browser to create the driver for

  • .for(browser, opts) ⇒ Driver

    Parameters:

    • browser (:ie, :internet_explorer, :edge, :remote, :chrome, :firefox, :ff, :safari)

      The browser to create the driver for

    • opts (Hash)

      Options passed to Driver.new

Returns:

See Also:

[View source]

88
89
90
# File 'lib/selenium/webdriver.rb', line 88

def self.for(*args)
  WebDriver::Driver.for(*args)
end