module Selenium::WebDriver

Constants

Dimension
Point
Rectangle
VERSION

Public Class Methods

for(*args) click to toggle source

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

@overload for(browser)

@param [:ie, :internet_explorer, :edge, :remote, :chrome, :firefox, :ff, :safari] browser The browser to
  create the driver for

@overload for(browser, opts)

@param [:ie, :internet_explorer, :edge, :remote, :chrome, :firefox, :ff, :safari] browser The browser to
  create the driver for
@param [Hash] opts Options passed to Driver.new

@return [Driver]

@see Selenium::WebDriver::Remote::Driver @see Selenium::WebDriver::Firefox::Driver @see Selenium::WebDriver::IE::Driver @see Selenium::WebDriver::Edge::Driver @see Selenium::WebDriver::Chrome::Driver @see Selenium::WebDriver::Safari::Driver

@example

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

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.

@see Selenium::WebDriver::Support::AbstractEventListener

# File lib/selenium/webdriver.rb, line 88
def self.for(*args)
  WebDriver::Driver.for(*args)
end
logger(**opts) click to toggle source

Returns logger instance that can be used across the whole Selenium.

@return [Logger]

# File lib/selenium/webdriver.rb, line 98
def self.logger(**opts)
  level = $DEBUG || ENV.key?('DEBUG') ? :debug : :info
  @logger ||= WebDriver::Logger.new('Selenium', default_level: level, **opts)
end
root() click to toggle source

@api private

# File lib/selenium/webdriver.rb, line 51
def self.root
  @root ||= File.expand_path('..', __dir__.to_s)
end