Class: Selenium::WebDriver::BiDi::Network Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::BiDi::Network
- Defined in:
- lib/selenium/webdriver/bidi/network.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Implements the Navigation Module of the WebDriver-BiDi specification Continue to use functionality from existing driver.navigate method
Constant Summary collapse
- EVENTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ before_request: 'network.beforeRequestSent', response_started: 'network.responseStarted', response_completed: 'network.responseCompleted', auth_required: 'network.authRequired', fetch_error: 'network.fetchError' }.freeze
- PHASES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ before_request: 'beforeRequestSent', response_started: 'responseStarted', auth_required: 'authRequired' }.freeze
Instance Method Summary collapse
- #add_intercept(phases: [], contexts: nil, url_patterns: nil, pattern_type: :string) ⇒ Object private
- #cancel_auth(request_id) ⇒ Object private
- #continue_request(**args) ⇒ Object private
- #continue_response(**args) ⇒ Object private
- #continue_with_auth(request_id, username, password) ⇒ Object private
- #continue_without_auth(request_id) ⇒ Object private
- #fail_request(request_id) ⇒ Object private
-
#initialize(bidi) ⇒ Network
constructor
private
A new instance of Network.
- #on(event, &block) ⇒ Object private
- #provide_response(**args) ⇒ Object private
- #remove_intercept(intercept) ⇒ Object private
- #set_cache_behavior(behavior, *contexts) ⇒ Object private
Constructor Details
#initialize(bidi) ⇒ Network
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.
Returns a new instance of Network.
45 46 47 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 45 def initialize(bidi) @bidi = bidi end |
Instance Method Details
#add_intercept(phases: [], contexts: nil, url_patterns: nil, pattern_type: :string) ⇒ 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.
49 50 51 52 53 54 55 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 49 def add_intercept(phases: [], contexts: nil, url_patterns: nil, pattern_type: :string) url_patterns = url_patterns && pattern_type ? UrlPattern.format_pattern(url_patterns, pattern_type) : nil @bidi.send_cmd('network.addIntercept', phases: phases, contexts: contexts, urlPatterns: url_patterns) end |
#cancel_auth(request_id) ⇒ 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.
82 83 84 85 86 87 88 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 82 def cancel_auth(request_id) @bidi.send_cmd( 'network.continueWithAuth', request: request_id, action: 'cancel' ) end |
#continue_request(**args) ⇒ 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.
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 90 def continue_request(**args) args = { request: args[:id], body: args[:body], cookies: args[:cookies], headers: args[:headers], method: args[:method], url: args[:url] }.compact @bidi.send_cmd('network.continueRequest', **args) end |
#continue_response(**args) ⇒ 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.
110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 110 def continue_response(**args) args = { request: args[:id], cookies: args[:cookies], credentials: args[:credentials], headers: args[:headers], reasonPhrase: args[:reason], statusCode: args[:status] }.compact @bidi.send_cmd('network.continueResponse', **args) end |
#continue_with_auth(request_id, username, password) ⇒ 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.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 61 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 |
#continue_without_auth(request_id) ⇒ 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.
74 75 76 77 78 79 80 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 74 def continue_without_auth(request_id) @bidi.send_cmd( 'network.continueWithAuth', request: request_id, action: 'default' ) end |
#fail_request(request_id) ⇒ 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.
103 104 105 106 107 108 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 103 def fail_request(request_id) @bidi.send_cmd( 'network.failRequest', request: request_id ) end |
#on(event, &block) ⇒ 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.
140 141 142 143 144 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 140 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @bidi.add_callback(event, &block) @bidi.session.subscribe(event) end |
#provide_response(**args) ⇒ 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.
123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 123 def provide_response(**args) args = { request: args[:id], body: args[:body], cookies: args[:cookies], headers: args[:headers], reasonPhrase: args[:reason], statusCode: args[:status] }.compact @bidi.send_cmd('network.provideResponse', **args) end |
#remove_intercept(intercept) ⇒ 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.
57 58 59 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 57 def remove_intercept(intercept) @bidi.send_cmd('network.removeIntercept', intercept: intercept) end |
#set_cache_behavior(behavior, *contexts) ⇒ 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.
136 137 138 |
# File 'lib/selenium/webdriver/bidi/network.rb', line 136 def set_cache_behavior(behavior, *contexts) @bidi.send_cmd('network.setCacheBehavior', cacheBehavior: behavior, contexts: contexts) end |