Module: Selenium::WebDriver::DriverExtensions::HasAuthentication Private
- Defined in:
- rb/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#register(username:, password:, uri: //) ⇒ Object
private
Registers basic authentication handler which is automatically used whenever browser gets an authentication required response.
Instance Method Details
#register(username:, password:, uri: //) ⇒ Object
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.
Registers basic authentication handler which is automatically used whenever browser gets an authentication required response. This currently relies on DevTools so is only supported in Chromium browsers.
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'rb/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb', line 42 def register(username:, password:, uri: //) auth_handlers << {username: username, password: password, uri: uri} devtools.network.set_cache_disabled(cache_disabled: true) devtools.fetch.on(:auth_required) do |params| authenticate(params['requestId'], params.dig('request', 'url')) end devtools.fetch.on(:request_paused) do |params| devtools.fetch.continue_request(request_id: params['requestId']) end devtools.fetch.enable(handle_auth_requests: true) end |