Module: Selenium::WebDriver

Defined in:
lib/selenium/webdriver.rb,
lib/selenium/webdriver/ie.rb,
lib/selenium/webdriver/bidi.rb,
lib/selenium/webdriver/edge.rb,
lib/selenium/webdriver/atoms.rb,
lib/selenium/webdriver/chrome.rb,
lib/selenium/webdriver/remote.rb,
lib/selenium/webdriver/safari.rb,
lib/selenium/webdriver/firefox.rb,
lib/selenium/webdriver/version.rb,
lib/selenium/webdriver/chromium.rb,
lib/selenium/webdriver/devtools.rb,
lib/selenium/webdriver/ie/driver.rb,
lib/selenium/webdriver/ie/options.rb,
lib/selenium/webdriver/ie/service.rb,
lib/selenium/webdriver/bidi/struct.rb,
lib/selenium/webdriver/common/keys.rb,
lib/selenium/webdriver/common/logs.rb,
lib/selenium/webdriver/common/wait.rb,
lib/selenium/webdriver/edge/driver.rb,
lib/selenium/webdriver/ie/features.rb,
lib/selenium/webdriver/bidi/session.rb,
lib/selenium/webdriver/common/alert.rb,
lib/selenium/webdriver/common/error.rb,
lib/selenium/webdriver/common/fedcm.rb,
lib/selenium/webdriver/common/proxy.rb,
lib/selenium/webdriver/edge/options.rb,
lib/selenium/webdriver/edge/profile.rb,
lib/selenium/webdriver/edge/service.rb,
lib/selenium/webdriver/firefox/util.rb,
lib/selenium/webdriver/chrome/driver.rb,
lib/selenium/webdriver/common/driver.rb,
lib/selenium/webdriver/common/logger.rb,
lib/selenium/webdriver/common/script.rb,
lib/selenium/webdriver/common/window.rb,
lib/selenium/webdriver/common/zipper.rb,
lib/selenium/webdriver/edge/features.rb,
lib/selenium/webdriver/remote/bridge.rb,
lib/selenium/webdriver/remote/driver.rb,
lib/selenium/webdriver/safari/driver.rb,
lib/selenium/webdriver/support/color.rb,
lib/selenium/webdriver/chrome/options.rb,
lib/selenium/webdriver/chrome/profile.rb,
lib/selenium/webdriver/chrome/service.rb,
lib/selenium/webdriver/common/element.rb,
lib/selenium/webdriver/common/manager.rb,
lib/selenium/webdriver/common/options.rb,
lib/selenium/webdriver/common/service.rb,
lib/selenium/webdriver/firefox/driver.rb,
lib/selenium/webdriver/safari/options.rb,
lib/selenium/webdriver/safari/service.rb,
lib/selenium/webdriver/support/guards.rb,
lib/selenium/webdriver/support/select.rb,
lib/selenium/webdriver/chrome/features.rb,
lib/selenium/webdriver/chromium/driver.rb,
lib/selenium/webdriver/common/platform.rb,
lib/selenium/webdriver/common/timeouts.rb,
lib/selenium/webdriver/firefox/options.rb,
lib/selenium/webdriver/firefox/profile.rb,
lib/selenium/webdriver/firefox/service.rb,
lib/selenium/webdriver/remote/features.rb,
lib/selenium/webdriver/remote/response.rb,
lib/selenium/webdriver/safari/features.rb,
lib/selenium/webdriver/support/escaper.rb,
lib/selenium/webdriver/bidi/log_handler.rb,
lib/selenium/webdriver/chromium/options.rb,
lib/selenium/webdriver/chromium/profile.rb,
lib/selenium/webdriver/common/log_entry.rb,
lib/selenium/webdriver/devtools/request.rb,
lib/selenium/webdriver/firefox/features.rb,
lib/selenium/webdriver/remote/http/curb.rb,
lib/selenium/webdriver/chromium/features.rb,
lib/selenium/webdriver/common/navigation.rb,
lib/selenium/webdriver/devtools/response.rb,
lib/selenium/webdriver/firefox/extension.rb,
lib/selenium/webdriver/bidi/log/filter_by.rb,
lib/selenium/webdriver/bidi/log_inspector.rb,
lib/selenium/webdriver/common/file_reaper.rb,
lib/selenium/webdriver/common/port_prober.rb,
lib/selenium/webdriver/common/shadow_root.rb,
lib/selenium/webdriver/common/socket_lock.rb,
lib/selenium/webdriver/remote/bidi_bridge.rb,
lib/selenium/webdriver/remote/http/common.rb,
lib/selenium/webdriver/common/fedcm/dialog.rb,
lib/selenium/webdriver/common/local_driver.rb,
lib/selenium/webdriver/remote/capabilities.rb,
lib/selenium/webdriver/remote/http/default.rb,
lib/selenium/webdriver/remote/server_error.rb,
lib/selenium/webdriver/bidi/navigate_result.rb,
lib/selenium/webdriver/common/child_process.rb,
lib/selenium/webdriver/common/driver_finder.rb,
lib/selenium/webdriver/common/fedcm/account.rb,
lib/selenium/webdriver/common/socket_poller.rb,
lib/selenium/webdriver/firefox/profiles_ini.rb,
lib/selenium/webdriver/support/guards/guard.rb,
lib/selenium/webdriver/bidi/browsing_context.rb,
lib/selenium/webdriver/common/action_builder.rb,
lib/selenium/webdriver/common/profile_helper.rb,
lib/selenium/webdriver/common/search_context.rb,
lib/selenium/webdriver/common/target_locator.rb,
lib/selenium/webdriver/common/service_manager.rb,
lib/selenium/webdriver/devtools/console_event.rb,
lib/selenium/webdriver/devtools/pinned_script.rb,
lib/selenium/webdriver/remote/bridge/commands.rb,
lib/selenium/webdriver/bidi/log/base_log_entry.rb,
lib/selenium/webdriver/common/selenium_manager.rb,
lib/selenium/webdriver/common/takes_screenshot.rb,
lib/selenium/webdriver/devtools/mutation_event.rb,
lib/selenium/webdriver/devtools/exception_event.rb,
lib/selenium/webdriver/support/relative_locator.rb,
lib/selenium/webdriver/common/interactions/pause.rb,
lib/selenium/webdriver/bidi/browsing_context_info.rb,
lib/selenium/webdriver/bidi/log/console_log_entry.rb,
lib/selenium/webdriver/bidi/log/generic_log_entry.rb,
lib/selenium/webdriver/common/html5/local_storage.rb,
lib/selenium/webdriver/common/interactions/scroll.rb,
lib/selenium/webdriver/common/websocket_connection.rb,
lib/selenium/webdriver/support/event_firing_bridge.rb,
lib/selenium/webdriver/common/html5/session_storage.rb,
lib/selenium/webdriver/devtools/network_interceptor.rb,
lib/selenium/webdriver/support/block_event_listener.rb,
lib/selenium/webdriver/bidi/log/javascript_log_entry.rb,
lib/selenium/webdriver/common/interactions/key_input.rb,
lib/selenium/webdriver/common/interactions/none_input.rb,
lib/selenium/webdriver/support/guards/guard_condition.rb,
lib/selenium/webdriver/common/html5/shared_web_storage.rb,
lib/selenium/webdriver/common/interactions/interaction.rb,
lib/selenium/webdriver/common/interactions/key_actions.rb,
lib/selenium/webdriver/common/interactions/wheel_input.rb,
lib/selenium/webdriver/remote/bridge/locator_converter.rb,
lib/selenium/webdriver/support/abstract_event_listener.rb,
lib/selenium/webdriver/common/driver_extensions/has_cdp.rb,
lib/selenium/webdriver/common/interactions/input_device.rb,
lib/selenium/webdriver/common/interactions/interactions.rb,
lib/selenium/webdriver/common/interactions/pointer_move.rb,
lib/selenium/webdriver/common/driver_extensions/has_bidi.rb,
lib/selenium/webdriver/common/driver_extensions/has_logs.rb,
lib/selenium/webdriver/common/interactions/pointer_input.rb,
lib/selenium/webdriver/common/interactions/pointer_press.rb,
lib/selenium/webdriver/common/interactions/scroll_origin.rb,
lib/selenium/webdriver/common/interactions/wheel_actions.rb,
lib/selenium/webdriver/common/interactions/pointer_cancel.rb,
lib/selenium/webdriver/common/driver_extensions/has_addons.rb,
lib/selenium/webdriver/common/interactions/pointer_actions.rb,
lib/selenium/webdriver/common/driver_extensions/has_casting.rb,
lib/selenium/webdriver/common/driver_extensions/has_context.rb,
lib/selenium/webdriver/common/driver_extensions/prints_page.rb,
lib/selenium/webdriver/common/driver_extensions/has_debugger.rb,
lib/selenium/webdriver/common/driver_extensions/has_devtools.rb,
lib/selenium/webdriver/common/driver_extensions/has_launching.rb,
lib/selenium/webdriver/common/driver_extensions/uploads_files.rb,
lib/selenium/webdriver/common/interactions/typing_interaction.rb,
lib/selenium/webdriver/common/driver_extensions/has_log_events.rb,
lib/selenium/webdriver/common/driver_extensions/has_session_id.rb,
lib/selenium/webdriver/common/virtual_authenticator/credential.rb,
lib/selenium/webdriver/common/driver_extensions/downloads_files.rb,
lib/selenium/webdriver/common/driver_extensions/has_permissions.rb,
lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb,
lib/selenium/webdriver/common/driver_extensions/has_fedcm_dialog.rb,
lib/selenium/webdriver/common/driver_extensions/has_authentication.rb,
lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rb,
lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb,
lib/selenium/webdriver/common/interactions/pointer_event_properties.rb,
lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb,
lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb,
lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb,
lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb,
lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb,
lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb

Defined Under Namespace

Modules: Atoms, Chrome, Chromium, DriverExtensions, Edge, Error, FedCM, FileReaper, Firefox, HTML5, IE, Interactions, KeyActions, Keys, LocalDriver, Platform, PointerActions, ProfileHelper, Remote, Safari, SearchContext, Support, TakesScreenshot, WheelActions, Zipper Classes: ActionBuilder, Alert, BiDi, ChildProcess, Credential, DevTools, Dimension, Driver, DriverFinder, Element, LogEntry, Logger, Logs, Manager, Navigation, Options, Point, PortProber, Proxy, Rectangle, Script, SeleniumManager, Service, ServiceManager, ShadowRoot, SocketLock, SocketPoller, TargetLocator, Timeouts, VirtualAuthenticator, VirtualAuthenticatorOptions, Wait, WebSocketConnection, Window

Constant Summary collapse

VERSION =
'4.25.0'

Class Method Summary collapse

Class Method Details

.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:



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

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

.logger(**opts) ⇒ Logger

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

Returns:



98
99
100
101
# 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

.rootObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



51
52
53
# File 'lib/selenium/webdriver.rb', line 51

def self.root
  @root ||= File.expand_path('..', __dir__.to_s)
end