Module: Selenium::WebDriver

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

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