Class: Selenium::WebDriver::BiDi::Network
- Inherits:
-
Object
- Object
- Selenium::WebDriver::BiDi::Network
- Defined in:
- lib/selenium/webdriver/bidi/network.rb
Constant Summary collapse
- EVENTS =
{ before_request: 'network.beforeRequestSent', response_started: 'network.responseStarted', response_completed: 'network.responseCompleted', auth_required: 'network.authRequired', FETCH_ERROR: 'network.fetchError' }.freeze
- PHASES =
{ before_request: 'beforeRequestSent', response_started: 'responseStarted', auth_required: 'authRequired' }.freeze
Instance Method Summary collapse
- #add_intercept(phases: [], contexts: nil, url_patterns: nil) ⇒ Object
- #continue_with_auth(request_id, username, password) ⇒ Object
-
#initialize(bidi) ⇒ Network
constructor
A new instance of Network.
- #on(event) ⇒ Object
- #remove_intercept(intercept) ⇒ Object
Constructor Details
#initialize(bidi) ⇒ Network
Returns a new instance of Network.
38 39 40 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 38 def initialize(bidi) @bidi = bidi end |
Instance Method Details
#add_intercept(phases: [], contexts: nil, url_patterns: nil) ⇒ Object
42 43 44 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 42 def add_intercept(phases: [], contexts: nil, url_patterns: nil) @bidi.send_cmd('network.addIntercept', phases: phases, contexts: contexts, urlPatterns: url_patterns) end |
#continue_with_auth(request_id, username, password) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 50 def continue_with_auth(request_id, username, password) @bidi.send_cmd( 'network.continueWithAuth', 'request' => request_id, 'action' => 'provideCredentials', 'credentials' => { 'type' => 'password', 'username' => username, 'password' => password } ) end |
#on(event) ⇒ Object
63 64 65 66 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 63 def on(event, &) event = EVENTS[event] if event.is_a?(Symbol) @bidi.add_callback(event, &) end |
#remove_intercept(intercept) ⇒ Object
46 47 48 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 46 def remove_intercept(intercept) @bidi.send_cmd('network.removeIntercept', intercept: intercept) end |