Class: Selenium::DevTools::V85::Network
- Inherits:
-
Object
- Object
- Selenium::DevTools::V85::Network
- Defined in:
- lib/selenium/devtools/v85/network.rb
Constant Summary collapse
- EVENTS =
{ data_received: 'dataReceived', event_source_message_received: 'eventSourceMessageReceived', loading_failed: 'loadingFailed', loading_finished: 'loadingFinished', request_intercepted: 'requestIntercepted', request_served_from_cache: 'requestServedFromCache', request_will_be_sent: 'requestWillBeSent', resource_changed_priority: 'resourceChangedPriority', signed_exchange_received: 'signedExchangeReceived', response_received: 'responseReceived', web_socket_closed: 'webSocketClosed', web_socket_created: 'webSocketCreated', web_socket_frame_error: 'webSocketFrameError', web_socket_frame_received: 'webSocketFrameReceived', web_socket_frame_sent: 'webSocketFrameSent', web_socket_handshake_response_received: 'webSocketHandshakeResponseReceived', web_socket_will_send_handshake_request: 'webSocketWillSendHandshakeRequest', request_will_be_sent_extra_info: 'requestWillBeSentExtraInfo', response_received_extra_info: 'responseReceivedExtraInfo', }.freeze
Instance Method Summary collapse
- #can_clear_browser_cache ⇒ Object
- #can_clear_browser_cookies ⇒ Object
- #can_emulate_network_conditions ⇒ Object
- #clear_browser_cache ⇒ Object
- #clear_browser_cookies ⇒ Object
- #continue_intercepted_request(interception_id:, error_reason: nil, raw_response: nil, url: nil, method: nil, post_data: nil, headers: nil, auth_challenge_response: nil) ⇒ Object
- #delete_cookies(name:, url: nil, domain: nil, path: nil) ⇒ Object
- #disable ⇒ Object
- #emulate_network_conditions(offline:, latency:, download_throughput:, upload_throughput:, connection_type: nil) ⇒ Object
- #enable(max_total_buffer_size: nil, max_resource_buffer_size: nil, max_post_data_size: nil) ⇒ Object
- #get_all_cookies ⇒ Object
- #get_certificate(origin:) ⇒ Object
- #get_cookies(urls: nil) ⇒ Object
- #get_request_post_data(request_id:) ⇒ Object
- #get_response_body(request_id:) ⇒ Object
- #get_response_body_for_interception(interception_id:) ⇒ Object
-
#initialize(devtools) ⇒ Network
constructor
A new instance of Network.
- #on(event, &block) ⇒ Object
- #replay_xhr(request_id:) ⇒ Object
- #search_in_response_body(request_id:, query:, case_sensitive: nil, is_regex: nil) ⇒ Object
- #set_blocked_urls(urls:) ⇒ Object
- #set_bypass_service_worker(bypass:) ⇒ Object
- #set_cache_disabled(cache_disabled:) ⇒ Object
- #set_cookie(name:, value:, url: nil, domain: nil, path: nil, secure: nil, http_only: nil, same_site: nil, expires: nil, priority: nil) ⇒ Object
- #set_cookies(cookies:) ⇒ Object
- #set_data_size_limits_for_test(max_total_size:, max_resource_size:) ⇒ Object
- #set_extra_http_headers(headers:) ⇒ Object
- #set_request_interception(patterns:) ⇒ Object
- #set_user_agent_override(user_agent:, accept_language: nil, platform: nil, user_agent_metadata: nil) ⇒ Object
- #take_response_body_for_interception_as_stream(interception_id:) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ Network
Returns a new instance of Network.
47 48 49 |
# File 'lib/selenium/devtools/v85/network.rb', line 47 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#can_clear_browser_cache ⇒ Object
56 57 58 |
# File 'lib/selenium/devtools/v85/network.rb', line 56 def can_clear_browser_cache @devtools.send_cmd('Network.canClearBrowserCache') end |
#can_clear_browser_cookies ⇒ Object
60 61 62 |
# File 'lib/selenium/devtools/v85/network.rb', line 60 def @devtools.send_cmd('Network.canClearBrowserCookies') end |
#can_emulate_network_conditions ⇒ Object
64 65 66 |
# File 'lib/selenium/devtools/v85/network.rb', line 64 def can_emulate_network_conditions @devtools.send_cmd('Network.canEmulateNetworkConditions') end |
#clear_browser_cache ⇒ Object
68 69 70 |
# File 'lib/selenium/devtools/v85/network.rb', line 68 def clear_browser_cache @devtools.send_cmd('Network.clearBrowserCache') end |
#clear_browser_cookies ⇒ Object
72 73 74 |
# File 'lib/selenium/devtools/v85/network.rb', line 72 def @devtools.send_cmd('Network.clearBrowserCookies') end |
#continue_intercepted_request(interception_id:, error_reason: nil, raw_response: nil, url: nil, method: nil, post_data: nil, headers: nil, auth_challenge_response: nil) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/selenium/devtools/v85/network.rb', line 76 def continue_intercepted_request(interception_id:, error_reason: nil, raw_response: nil, url: nil, method: nil, post_data: nil, headers: nil, auth_challenge_response: nil) @devtools.send_cmd('Network.continueInterceptedRequest', interceptionId: interception_id, errorReason: error_reason, rawResponse: raw_response, url: url, method: method, postData: post_data, headers: headers, authChallengeResponse: auth_challenge_response) end |
#delete_cookies(name:, url: nil, domain: nil, path: nil) ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/selenium/devtools/v85/network.rb', line 88 def (name:, url: nil, domain: nil, path: nil) @devtools.send_cmd('Network.deleteCookies', name: name, url: url, domain: domain, path: path) end |
#disable ⇒ Object
96 97 98 |
# File 'lib/selenium/devtools/v85/network.rb', line 96 def disable @devtools.send_cmd('Network.disable') end |
#emulate_network_conditions(offline:, latency:, download_throughput:, upload_throughput:, connection_type: nil) ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/selenium/devtools/v85/network.rb', line 100 def emulate_network_conditions(offline:, latency:, download_throughput:, upload_throughput:, connection_type: nil) @devtools.send_cmd('Network.emulateNetworkConditions', offline: offline, latency: latency, downloadThroughput: download_throughput, uploadThroughput: upload_throughput, connectionType: connection_type) end |
#enable(max_total_buffer_size: nil, max_resource_buffer_size: nil, max_post_data_size: nil) ⇒ Object
109 110 111 112 113 114 |
# File 'lib/selenium/devtools/v85/network.rb', line 109 def enable(max_total_buffer_size: nil, max_resource_buffer_size: nil, max_post_data_size: nil) @devtools.send_cmd('Network.enable', maxTotalBufferSize: max_total_buffer_size, maxResourceBufferSize: max_resource_buffer_size, maxPostDataSize: max_post_data_size) end |
#get_all_cookies ⇒ Object
116 117 118 |
# File 'lib/selenium/devtools/v85/network.rb', line 116 def @devtools.send_cmd('Network.getAllCookies') end |
#get_certificate(origin:) ⇒ Object
120 121 122 123 |
# File 'lib/selenium/devtools/v85/network.rb', line 120 def get_certificate(origin:) @devtools.send_cmd('Network.getCertificate', origin: origin) end |
#get_cookies(urls: nil) ⇒ Object
125 126 127 128 |
# File 'lib/selenium/devtools/v85/network.rb', line 125 def (urls: nil) @devtools.send_cmd('Network.getCookies', urls: urls) end |
#get_request_post_data(request_id:) ⇒ Object
135 136 137 138 |
# File 'lib/selenium/devtools/v85/network.rb', line 135 def get_request_post_data(request_id:) @devtools.send_cmd('Network.getRequestPostData', requestId: request_id) end |
#get_response_body(request_id:) ⇒ Object
130 131 132 133 |
# File 'lib/selenium/devtools/v85/network.rb', line 130 def get_response_body(request_id:) @devtools.send_cmd('Network.getResponseBody', requestId: request_id) end |
#get_response_body_for_interception(interception_id:) ⇒ Object
140 141 142 143 |
# File 'lib/selenium/devtools/v85/network.rb', line 140 def get_response_body_for_interception(interception_id:) @devtools.send_cmd('Network.getResponseBodyForInterception', interceptionId: interception_id) end |
#on(event, &block) ⇒ Object
51 52 53 54 |
# File 'lib/selenium/devtools/v85/network.rb', line 51 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["Network.#{event}"] << block end |
#replay_xhr(request_id:) ⇒ Object
150 151 152 153 |
# File 'lib/selenium/devtools/v85/network.rb', line 150 def replay_xhr(request_id:) @devtools.send_cmd('Network.replayXHR', requestId: request_id) end |
#search_in_response_body(request_id:, query:, case_sensitive: nil, is_regex: nil) ⇒ Object
155 156 157 158 159 160 161 |
# File 'lib/selenium/devtools/v85/network.rb', line 155 def search_in_response_body(request_id:, query:, case_sensitive: nil, is_regex: nil) @devtools.send_cmd('Network.searchInResponseBody', requestId: request_id, query: query, caseSensitive: case_sensitive, isRegex: is_regex) end |
#set_blocked_urls(urls:) ⇒ Object
163 164 165 166 |
# File 'lib/selenium/devtools/v85/network.rb', line 163 def set_blocked_urls(urls:) @devtools.send_cmd('Network.setBlockedURLs', urls: urls) end |
#set_bypass_service_worker(bypass:) ⇒ Object
168 169 170 171 |
# File 'lib/selenium/devtools/v85/network.rb', line 168 def set_bypass_service_worker(bypass:) @devtools.send_cmd('Network.setBypassServiceWorker', bypass: bypass) end |
#set_cache_disabled(cache_disabled:) ⇒ Object
173 174 175 176 |
# File 'lib/selenium/devtools/v85/network.rb', line 173 def set_cache_disabled(cache_disabled:) @devtools.send_cmd('Network.setCacheDisabled', cacheDisabled: cache_disabled) end |
#set_cookie(name:, value:, url: nil, domain: nil, path: nil, secure: nil, http_only: nil, same_site: nil, expires: nil, priority: nil) ⇒ Object
178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/selenium/devtools/v85/network.rb', line 178 def (name:, value:, url: nil, domain: nil, path: nil, secure: nil, http_only: nil, same_site: nil, expires: nil, priority: nil) @devtools.send_cmd('Network.setCookie', name: name, value: value, url: url, domain: domain, path: path, secure: secure, httpOnly: http_only, sameSite: same_site, expires: expires, priority: priority) end |
#set_cookies(cookies:) ⇒ Object
192 193 194 195 |
# File 'lib/selenium/devtools/v85/network.rb', line 192 def (cookies:) @devtools.send_cmd('Network.setCookies', cookies: ) end |
#set_data_size_limits_for_test(max_total_size:, max_resource_size:) ⇒ Object
197 198 199 200 201 |
# File 'lib/selenium/devtools/v85/network.rb', line 197 def set_data_size_limits_for_test(max_total_size:, max_resource_size:) @devtools.send_cmd('Network.setDataSizeLimitsForTest', maxTotalSize: max_total_size, maxResourceSize: max_resource_size) end |
#set_extra_http_headers(headers:) ⇒ Object
203 204 205 206 |
# File 'lib/selenium/devtools/v85/network.rb', line 203 def set_extra_http_headers(headers:) @devtools.send_cmd('Network.setExtraHTTPHeaders', headers: headers) end |
#set_request_interception(patterns:) ⇒ Object
208 209 210 211 |
# File 'lib/selenium/devtools/v85/network.rb', line 208 def set_request_interception(patterns:) @devtools.send_cmd('Network.setRequestInterception', patterns: patterns) end |
#set_user_agent_override(user_agent:, accept_language: nil, platform: nil, user_agent_metadata: nil) ⇒ Object
213 214 215 216 217 218 219 |
# File 'lib/selenium/devtools/v85/network.rb', line 213 def set_user_agent_override(user_agent:, accept_language: nil, platform: nil, user_agent_metadata: nil) @devtools.send_cmd('Network.setUserAgentOverride', userAgent: user_agent, acceptLanguage: accept_language, platform: platform, userAgentMetadata: ) end |
#take_response_body_for_interception_as_stream(interception_id:) ⇒ Object
145 146 147 148 |
# File 'lib/selenium/devtools/v85/network.rb', line 145 def take_response_body_for_interception_as_stream(interception_id:) @devtools.send_cmd('Network.takeResponseBodyForInterceptionAsStream', interceptionId: interception_id) end |