Class: Selenium::WebDriver::Network
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Network
- Defined in:
- lib/selenium/webdriver/common/network.rb
Instance Attribute Summary collapse
-
#auth_callbacks ⇒ Object
readonly
Returns the value of attribute auth_callbacks.
Instance Method Summary collapse
- #add_authentication_handler(username, password) ⇒ Object
- #clear_authentication_handlers ⇒ Object
-
#initialize(bridge) ⇒ Network
constructor
A new instance of Network.
- #remove_authentication_handler(id) ⇒ Object
Constructor Details
Instance Attribute Details
#auth_callbacks ⇒ Object (readonly)
Returns the value of attribute auth_callbacks.
23 24 25 |
# File 'lib/selenium/webdriver/common/network.rb', line 23 def auth_callbacks @auth_callbacks end |
Instance Method Details
#add_authentication_handler(username, password) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/selenium/webdriver/common/network.rb', line 30 def add_authentication_handler(username, password) intercept = @network.add_intercept(phases: [BiDi::Network::PHASES[:auth_required]]) auth_id = @network.on(:auth_required) do |event| request_id = event['requestId'] @network.continue_with_auth(request_id, username, password) end @auth_callbacks[auth_id] = intercept auth_id end |
#clear_authentication_handlers ⇒ Object
47 48 49 |
# File 'lib/selenium/webdriver/common/network.rb', line 47 def clear_authentication_handlers @auth_callbacks.each_key { |id| remove_authentication_handler(id) } end |
#remove_authentication_handler(id) ⇒ Object
41 42 43 44 45 |
# File 'lib/selenium/webdriver/common/network.rb', line 41 def remove_authentication_handler(id) intercept = @auth_callbacks[id] @network.remove_intercept(intercept['intercept']) @auth_callbacks.delete(id) end |