SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.85k stars 8.22k forks source link

[πŸ› Bug]: intercepted response cannot change response code (ruby) #11332

Closed echoidcf closed 1 year ago

echoidcf commented 2 years ago

What happened?

driver.intercept do |request, &continue|
end

can perfectly replace the response body but not the response code. With the code below, I can get the intercepted body, but the response code is still 404 (I hope it to be 200)

How can we reproduce the issue?

require 'selenium-webdriver'

driver = Selenium::WebDriver.for :remote, url: "http://localhost:4444/wd/hub", capabilities: :chrome
driver.intercept do |request, &continue|
    uri = URI(request.url)
    if uri.path.end_with?('/not_exist.html')
        continue.call(request) do |r|
            r.code = 200
            r.body = "intercepted"
        end
    else
        continue.call(request)
    end
end

sleep 20
driver.navigate.to "http://www.google.com/not_exist.html"
sleep 20

driver.quit

Relevant log output

NA

Operating System

Centos7

Selenium version

Ruby 4.6.1

What are the browser(s) and version(s) where you see this issue?

Chrome 107

What are the browser driver(s) and version(s) where you see this issue?

browserVersion: 107.0.5304.87,chromedriverVersion: 107.0.5304.62

Are you using Selenium Grid?

Selenium Standalone 4.6.0

github-actions[bot] commented 2 years ago

@echoidcf, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

p0deje commented 2 years ago

It should be possible to mutate the response code. Can you please re-run the following code with Selenium::WebDriver.logger.level = :debug before and post the output?

echoidcf commented 2 years ago

I know it should be. I check the source code, and it seems nothing wrong with it. But it happened.

2022-11-30 09:32:43 INFO Selenium -> POST session
2022-11-30 09:32:43 INFO Selenium    >>> http://localhost:4444/wd/hub/session | {"capabilities":{"alwaysMatch":{"browserName":"chrome"}}}
2022-11-30 09:32:43 DEBUG Selenium      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.6.1 (ruby linux)", "Content-Length"=>"57"}
2022-11-30 09:32:44 INFO Selenium <- {
  "value": {
    "sessionId": "fd077ce42a9e5fd6a03e74f04241469f",
![γ‚³γƒ‘γƒ³γƒˆ 2022-11-30 093322](https://user-images.githubusercontent.com/25361271/204679333-7f85d963-1f39-46f6-9c07-a2acd83b0191.png)

    "capabilities": {
      "acceptInsecureCerts": false,
      "browserName": "chrome",
      "browserVersion": "107.0.5304.87",
      "chrome": {
        "chromedriverVersion": "107.0.5304.62 (1eec40d3a5764881c92085aaee66d25075c159aa-refs\u002fbranch-heads\u002f5304@{#942})",
        "userDataDir": "\u002ftmp\u002f.com.google.Chrome.xhFE1o"
      },
      "goog:chromeOptions": {
        "debuggerAddress": "localhost:46563"
      },
      "networkConnectionEnabled": false,
      "pageLoadStrategy": "normal",
      "platformName": "LINUX",
      "proxy": {
      },
      "se:bidiEnabled": false,
      "se:cdp": "ws:\u002f\u002f192.168.16.1:4444\u002fsession\u002ffd077ce42a9e5fd6a03e74f04241469f\u002fse\u002fcdp",
      "se:cdpVersion": "107.0.5304.87",
      "se:vnc": "ws:\u002f\u002f192.168.16.1:4444\u002fsession\u002ffd077ce42a9e5fd6a03e74f04241469f\u002fse\u002fvnc",
      "se:vncEnabled": true,
      "se:vncLocalAddress": "ws:\u002f\u002f192.168.16.1:7900",
      "setWindowRect": true,
      "strictFileInteractability": false,
      "timeouts": {
        "implicit": 0,
        "pageLoad": 300000,
        "script": 30000
      },
      "unhandledPromptBehavior": "dismiss and notify",
      "webauthn:extension:credBlob": true,
      "webauthn:extension:largeBlob": true,
      "webauthn:virtualAuthenticators": true
    }
  }
}
/home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/digest-3.1.0/lib/digest.rb:20: warning: already initialized constant Digest::REQUIRE_MUTEX
/home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/3.0.0/digest.rb:6: warning: previous definition of REQUIRE_MUTEX was here
2022-11-30 09:32:44 DEBUG Selenium WebSocket -> {:method=>"Target.getTargets", :params=>{}, :id=>1}
2022-11-30 09:32:44 DEBUG Selenium WebSocket <- {"id"=>1, "result"=>{"targetInfos"=>[{"targetId"=>"EB9545DF25F68498F58B47FE04276770", "type"=>"page", "title"=>"data:,", "url"=>"data:,", "attached"=>true, "canAccessOpener"=>false, "browserContextId"=>"926E92F7B8E976077953CC8194E285E3"}]}}
2022-11-30 09:32:44 DEBUG Selenium WebSocket -> {:method=>"Target.attachToTarget", :params=>{:targetId=>"EB9545DF25F68498F58B47FE04276770", :flatten=>true}, :id=>2}
2022-11-30 09:32:44 DEBUG Selenium WebSocket <- {"method"=>"Target.attachedToTarget", "params"=>{"sessionId"=>"D67C4350695954D527234799C50D3F55", "targetInfo"=>{"targetId"=>"EB9545DF25F68498F58B47FE04276770", "type"=>"page", "title"=>"data:,", "url"=>"data:,", "attached"=>true, "canAccessOpener"=>false, "browserContextId"=>"926E92F7B8E976077953CC8194E285E3"}, "waitingForDebugger"=>false}}
2022-11-30 09:32:44 DEBUG Selenium WebSocket <- {"id"=>2, "result"=>{"sessionId"=>"D67C4350695954D527234799C50D3F55"}}
2022-11-30 09:32:44 DEBUG Selenium WebSocket -> {:method=>"Network.setCacheDisabled", :params=>{:cacheDisabled=>true}, :sessionId=>"D67C4350695954D527234799C50D3F55", :id=>3}
2022-11-30 09:32:44 DEBUG Selenium WebSocket <- {"id"=>3, "result"=>{}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:32:44 DEBUG Selenium WebSocket -> {:method=>"Network.enable", :params=>{}, :sessionId=>"D67C4350695954D527234799C50D3F55", :id=>4}
2022-11-30 09:32:44 DEBUG Selenium WebSocket <- {"id"=>4, "result"=>{}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:32:44 DEBUG Selenium WebSocket -> {:method=>"Fetch.enable", :params=>{:patterns=>[{:requestStage=>"Request"}, {:requestStage=>"Response"}]}, :sessionId=>"D67C4350695954D527234799C50D3F55", :id=>5}
2022-11-30 09:32:44 DEBUG Selenium WebSocket <- {"id"=>5, "result"=>{}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:32:54 DEBUG Selenium WebSocket <- {"method"=>"Network.responseReceived", "params"=>{"requestId"=>"451.2", "loaderId"=>"4ACEB63FAAFB7651CD10F5924BCA5330", "timestamp"=>106874826.575729, "type"=>"Other", "response"=>{"url"=>"data:,", "status"=>200, "statusText"=>"OK", "headers"=>{"Content-Type"=>"text/plain;charset=US-ASCII"}, "mimeType"=>"text/plain", "connectionReused"=>false, "connectionId"=>0, "fromDiskCache"=>false, "fromServiceWorker"=>false, "fromPrefetchCache"=>false, "encodedDataLength"=>0, "protocol"=>"data", "securityState"=>"unknown"}, "hasExtraInfo"=>false, "frameId"=>"EB9545DF25F68498F58B47FE04276770"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:32:54 DEBUG Selenium WebSocket <- {"method"=>"Network.loadingFinished", "params"=>{"requestId"=>"451.2", "timestamp"=>106874826.575821, "encodedDataLength"=>0, "shouldReportCorbBlocking"=>false}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 INFO Selenium -> POST session/fd077ce42a9e5fd6a03e74f04241469f/url
2022-11-30 09:33:04 INFO Selenium    >>> http://localhost:4444/wd/hub/session/fd077ce42a9e5fd6a03e74f04241469f/url | {"url":"http://www.google.com/not_exist.html"}
2022-11-30 09:33:04 DEBUG Selenium      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.6.1 (ruby linux)", "Content-Length"=>"46"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Network.requestWillBeSent", "params"=>{"requestId"=>"378A282A979910FF7A6D77C2E5AA348F", "loaderId"=>"378A282A979910FF7A6D77C2E5AA348F", "documentURL"=>"http://www.google.com/not_exist.html", "request"=>{"url"=>"http://www.google.com/not_exist.html", "method"=>"GET", "headers"=>{"Upgrade-Insecure-Requests"=>"1", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "mixedContentType"=>"none", "initialPriority"=>"VeryHigh", "referrerPolicy"=>"strict-origin-when-cross-origin", "isSameSite"=>true}, "timestamp"=>106874836.965941, "wallTime"=>1669768384.814426, "initiator"=>{"type"=>"other"}, "redirectHasExtraInfo"=>false, "type"=>"Document", "frameId"=>"EB9545DF25F68498F58B47FE04276770", "hasUserGesture"=>false}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Fetch.requestPaused", "params"=>{"requestId"=>"interception-job-1.0", "request"=>{"url"=>"http://www.google.com/not_exist.html", "method"=>"GET", "headers"=>{"Accept"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Upgrade-Insecure-Requests"=>"1", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "initialPriority"=>"VeryHigh", "referrerPolicy"=>"strict-origin-when-cross-origin"}, "frameId"=>"EB9545DF25F68498F58B47FE04276770", "resourceType"=>"Document", "networkId"=>"378A282A979910FF7A6D77C2E5AA348F"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket -> {:method=>"Fetch.continueRequest", :params=>{:requestId=>"interception-job-1.0"}, :sessionId=>"D67C4350695954D527234799C50D3F55", :id=>6}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"id"=>6, "result"=>{}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Network.requestWillBeSentExtraInfo", "params"=>{"requestId"=>"378A282A979910FF7A6D77C2E5AA348F", "associatedCookies"=>[], "headers"=>{"Accept"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Accept-Encoding"=>"gzip, deflate", "Accept-Language"=>"en-US,en;q=0.9", "Cache-Control"=>"no-cache", "Connection"=>"keep-alive", "Host"=>"www.google.com", "Pragma"=>"no-cache", "Upgrade-Insecure-Requests"=>"1", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "connectTiming"=>{"requestTime"=>106874836.976512}}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Network.responseReceivedExtraInfo", "params"=>{"requestId"=>"378A282A979910FF7A6D77C2E5AA348F", "blockedCookies"=>[], "headers"=>{"Content-Length"=>"1575", "Content-Type"=>"text/html; charset=UTF-8", "Date"=>"Wed, 30 Nov 2022 00:33:04 GMT", "Referrer-Policy"=>"no-referrer"}, "resourceIPAddressSpace"=>"Public", "statusCode"=>404, "headersText"=>"HTTP/1.1 404 Not Found\r\nContent-Type: text/html; charset=UTF-8\r\nReferrer-Policy: no-referrer\r\nContent-Length: 1575\r\nDate: Wed, 30 Nov 2022 00:33:04 GMT\r\n\r\n"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Fetch.requestPaused", "params"=>{"requestId"=>"interception-job-1.0", "request"=>{"url"=>"http://www.google.com/not_exist.html", "method"=>"GET", "headers"=>{"Accept"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Upgrade-Insecure-Requests"=>"1", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "initialPriority"=>"VeryHigh", "referrerPolicy"=>"strict-origin-when-cross-origin"}, "frameId"=>"EB9545DF25F68498F58B47FE04276770", "resourceType"=>"Document", "responseStatusCode"=>404, "responseStatusText"=>"Not Found", "responseHeaders"=>[{"name"=>"Content-Type", "value"=>"text/html; charset=UTF-8"}, {"name"=>"Referrer-Policy", "value"=>"no-referrer"}, {"name"=>"Content-Length", "value"=>"1575"}, {"name"=>"Date", "value"=>"Wed, 30 Nov 2022 00:33:04 GMT"}], "networkId"=>"378A282A979910FF7A6D77C2E5AA348F"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket -> {:method=>"Fetch.getResponseBody", :params=>{:requestId=>"interception-job-1.0"}, :sessionId=>"D67C4350695954D527234799C50D3F55", :id=>7}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"id"=>7, "result"=>{"body"=>"PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ZW4+CiAgPG1ldGEgY2hhcnNldD11dGYtOD4KICA8bWV0YSBuYW1lPXZpZXdwb3J0IGNvbnRlbnQ9ImluaXRpYWwtc2NhbGU9MSwgbWluaW11bS1zY2FsZT0xLCB3aWR0aD1kZXZpY2Utd2lkdGgiPgogIDx0aXRsZT5FcnJvciA0MDQgKE5vdCBGb3VuZCkhITE8L3RpdGxlPgogIDxzdHlsZT4KICAgICp7bWFyZ2luOjA7cGFkZGluZzowfWh0bWwsY29kZXtmb250OjE1cHgvMjJweCBhcmlhbCxzYW5zLXNlcmlmfWh0bWx7YmFja2dyb3VuZDojZmZmO2NvbG9yOiMyMjI7cGFkZGluZzoxNXB4fWJvZHl7bWFyZ2luOjclIGF1dG8gMDttYXgtd2lkdGg6MzkwcHg7bWluLWhlaWdodDoxODBweDtwYWRkaW5nOjMwcHggMCAxNXB4fSogPiBib2R5e2JhY2tncm91bmQ6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2Vycm9ycy9yb2JvdC5wbmcpIDEwMCUgNXB4IG5vLXJlcGVhdDtwYWRkaW5nLXJpZ2h0OjIwNXB4fXB7bWFyZ2luOjExcHggMCAyMnB4O292ZXJmbG93OmhpZGRlbn1pbnN7Y29sb3I6Izc3Nzt0ZXh0LWRlY29yYXRpb246bm9uZX1hIGltZ3tib3JkZXI6MH1AbWVkaWEgc2NyZWVuIGFuZCAobWF4LXdpZHRoOjc3MnB4KXtib2R5e2JhY2tncm91bmQ6bm9uZTttYXJnaW4tdG9wOjA7bWF4LXdpZHRoOm5vbmU7cGFkZGluZy1yaWdodDowfX0jbG9nb3tiYWNrZ3JvdW5kOnVybCgvL3d3dy5nb29nbGUuY29tL2ltYWdlcy9icmFuZGluZy9nb29nbGVsb2dvLzF4L2dvb2dsZWxvZ29fY29sb3JfMTUweDU0ZHAucG5nKSBuby1yZXBlYXQ7bWFyZ2luLWxlZnQ6LTVweH1AbWVkaWEgb25seSBzY3JlZW4gYW5kIChtaW4tcmVzb2x1dGlvbjoxOTJkcGkpeyNsb2dve2JhY2tncm91bmQ6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2JyYW5kaW5nL2dvb2dsZWxvZ28vMngvZ29vZ2xlbG9nb19jb2xvcl8xNTB4NTRkcC5wbmcpIG5vLXJlcGVhdCAwJSAwJS8xMDAlIDEwMCU7LW1vei1ib3JkZXItaW1hZ2U6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2JyYW5kaW5nL2dvb2dsZWxvZ28vMngvZ29vZ2xlbG9nb19jb2xvcl8xNTB4NTRkcC5wbmcpIDB9fUBtZWRpYSBvbmx5IHNjcmVlbiBhbmQgKC13ZWJraXQtbWluLWRldmljZS1waXhlbC1yYXRpbzoyKXsjbG9nb3tiYWNrZ3JvdW5kOnVybCgvL3d3dy5nb29nbGUuY29tL2ltYWdlcy9icmFuZGluZy9nb29nbGVsb2dvLzJ4L2dvb2dsZWxvZ29fY29sb3JfMTUweDU0ZHAucG5nKSBuby1yZXBlYXQ7LXdlYmtpdC1iYWNrZ3JvdW5kLXNpemU6MTAwJSAxMDAlfX0jbG9nb3tkaXNwbGF5OmlubGluZS1ibG9jaztoZWlnaHQ6NTRweDt3aWR0aDoxNTBweH0KICA8L3N0eWxlPgogIDxhIGhyZWY9Ly93d3cuZ29vZ2xlLmNvbS8+PHNwYW4gaWQ9bG9nbyBhcmlhLWxhYmVsPUdvb2dsZT48L3NwYW4+PC9hPgogIDxwPjxiPjQwNC48L2I+IDxpbnM+VGhhdOKAmXMgYW4gZXJyb3IuPC9pbnM+CiAgPHA+VGhlIHJlcXVlc3RlZCBVUkwgPGNvZGU+L25vdF9leGlzdC5odG1sPC9jb2RlPiB3YXMgbm90IGZvdW5kIG9uIHRoaXMgc2VydmVyLiAgPGlucz5UaGF04oCZcyBhbGwgd2Uga25vdy48L2lucz4K", "base64Encoded"=>true}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket -> {:method=>"Fetch.fulfillRequest", :params=>{:requestId=>"interception-job-1.0", :responseCode=>200, :responseHeaders=>[{:name=>"Content-Type", :value=>"text/html; charset=UTF-8"}, {:name=>"Referrer-Policy", :value=>"no-referrer"}, {:name=>"Content-Length", :value=>"1575"}, {:name=>"Date", :value=>"Wed, 30 Nov 2022 00:33:04 GMT"}], :body=>"aW50ZXJjZXB0ZWQ="}, :sessionId=>"D67C4350695954D527234799C50D3F55", :id=>8}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"id"=>8, "result"=>{}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Network.responseReceived", "params"=>{"requestId"=>"378A282A979910FF7A6D77C2E5AA348F", "loaderId"=>"378A282A979910FF7A6D77C2E5AA348F", "timestamp"=>106874837.113321, "type"=>"Document", "response"=>{"url"=>"http://www.google.com/not_exist.html", "status"=>200, "statusText"=>"OK", "headers"=>{"Content-Length"=>"1575", "Content-Type"=>"text/html; charset=UTF-8", "Date"=>"Wed, 30 Nov 2022 00:33:04 GMT", "Referrer-Policy"=>"no-referrer"}, "mimeType"=>"text/html", "connectionReused"=>false, "connectionId"=>0, "remoteIPAddress"=>"", "remotePort"=>0, "fromDiskCache"=>false, "fromServiceWorker"=>false, "fromPrefetchCache"=>false, "encodedDataLength"=>138, "timing"=>{"requestTime"=>106874836.967957, "proxyStart"=>-1, "proxyEnd"=>-1, "dnsStart"=>-1, "dnsEnd"=>-1, "connectStart"=>-1, "connectEnd"=>-1, "sslStart"=>-1, "sslEnd"=>-1, "workerStart"=>-1, "workerReady"=>-1, "workerFetchStart"=>-1, "workerRespondWithSettled"=>-1, "sendStart"=>-1, "sendEnd"=>-1, "pushStart"=>0, "pushEnd"=>0, "receiveHeadersEnd"=>142.869}, "responseTime"=>1669768384959.287, "protocol"=>"http/1.1", "securityState"=>"insecure"}, "hasExtraInfo"=>false, "frameId"=>"EB9545DF25F68498F58B47FE04276770"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Network.dataReceived", "params"=>{"requestId"=>"378A282A979910FF7A6D77C2E5AA348F", "timestamp"=>106874837.126809, "dataLength"=>11, "encodedDataLength"=>0}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Network.loadingFinished", "params"=>{"requestId"=>"378A282A979910FF7A6D77C2E5AA348F", "timestamp"=>106874837.110844, "encodedDataLength"=>149, "shouldReportCorbBlocking"=>false}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"method"=>"Network.requestWillBeSent", "params"=>{"requestId"=>"522.2", "loaderId"=>"378A282A979910FF7A6D77C2E5AA348F", "documentURL"=>"http://www.google.com/not_exist.html", "request"=>{"url"=>"http://www.google.com/favicon.ico", "method"=>"GET", "headers"=>{"Referer"=>"", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "mixedContentType"=>"none", "initialPriority"=>"High", "referrerPolicy"=>"no-referrer", "isSameSite"=>true}, "timestamp"=>106874837.144466, "wallTime"=>1669768384.993033, "initiator"=>{"type"=>"other"}, "redirectHasExtraInfo"=>false, "type"=>"Other", "frameId"=>"EB9545DF25F68498F58B47FE04276770", "hasUserGesture"=>false}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"method"=>"Fetch.requestPaused", "params"=>{"requestId"=>"interception-job-2.0", "request"=>{"url"=>"http://www.google.com/favicon.ico", "method"=>"GET", "headers"=>{"Accept"=>"image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "initialPriority"=>"High", "referrerPolicy"=>"no-referrer"}, "frameId"=>"EB9545DF25F68498F58B47FE04276770", "resourceType"=>"Other", "networkId"=>"522.2"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket -> {:method=>"Fetch.continueRequest", :params=>{:requestId=>"interception-job-2.0"}, :sessionId=>"D67C4350695954D527234799C50D3F55", :id=>9}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"id"=>9, "result"=>{}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 INFO Selenium <- {"value":null}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"method"=>"Network.requestWillBeSentExtraInfo", "params"=>{"requestId"=>"522.2", "associatedCookies"=>[], "headers"=>{"Accept"=>"image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8", "Accept-Encoding"=>"gzip, deflate", "Accept-Language"=>"en-US,en;q=0.9", "Cache-Control"=>"no-cache", "Connection"=>"keep-alive", "Host"=>"www.google.com", "Pragma"=>"no-cache", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "connectTiming"=>{"requestTime"=>106874837.159402}, "clientSecurityState"=>{"initiatorIsSecureContext"=>false, "initiatorIPAddressSpace"=>"Unknown", "privateNetworkRequestPolicy"=>"Allow"}}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"method"=>"Network.responseReceivedExtraInfo", "params"=>{"requestId"=>"522.2", "blockedCookies"=>[], "headers"=>{"Accept-Ranges"=>"bytes", "Age"=>"29847", "Cache-Control"=>"public, max-age=691200", "Content-Encoding"=>"gzip", "Content-Length"=>"1494", "Content-Type"=>"image/x-icon", "Cross-Origin-Opener-Policy-Report-Only"=>"same-origin; report-to=\"static-on-bigtable\"", "Cross-Origin-Resource-Policy"=>"cross-origin", "Date"=>"Tue, 29 Nov 2022 16:15:38 GMT", "Expires"=>"Wed, 07 Dec 2022 16:15:38 GMT", "Last-Modified"=>"Tue, 22 Oct 2019 18:30:00 GMT", "Report-To"=>"{\"group\":\"static-on-bigtable\",\"max_age\":2592000,\"endpoints\":[{\"url\":\"https://csp.withgoogle.com/csp/report-to/static-on-bigtable\"}]}", "Server"=>"sffe", "Vary"=>"Accept-Encoding", "X-Content-Type-Options"=>"nosniff", "X-XSS-Protection"=>"0"}, "resourceIPAddressSpace"=>"Public", "statusCode"=>200, "headersText"=>"HTTP/1.1 200 OK\r\nAccept-Ranges: bytes\r\nVary: Accept-Encoding\r\nContent-Encoding: gzip\r\nCross-Origin-Resource-Policy: cross-origin\r\nCross-Origin-Opener-Policy-Report-Only: same-origin; report-to=\"static-on-bigtable\"\r\nReport-To: {\"group\":\"static-on-bigtable\",\"max_age\":2592000,\"endpoints\":[{\"url\":\"https://csp.withgoogle.com/csp/report-to/static-on-bigtable\"}]}\r\nContent-Length: 1494\r\nX-Content-Type-Options: nosniff\r\nServer: sffe\r\nX-XSS-Protection: 0\r\nDate: Tue, 29 Nov 2022 16:15:38 GMT\r\nExpires: Wed, 07 Dec 2022 16:15:38 GMT\r\nCache-Control: public, max-age=691200\r\nLast-Modified: Tue, 22 Oct 2019 18:30:00 GMT\r\nContent-Type: image/x-icon\r\nAge: 29847\r\n\r\n"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"method"=>"Fetch.requestPaused", "params"=>{"requestId"=>"interception-job-2.0", "request"=>{"url"=>"http://www.google.com/favicon.ico", "method"=>"GET", "headers"=>{"Accept"=>"image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "initialPriority"=>"High", "referrerPolicy"=>"no-referrer"}, "frameId"=>"EB9545DF25F68498F58B47FE04276770", "resourceType"=>"Other", "responseStatusCode"=>200, "responseStatusText"=>"OK", "responseHeaders"=>[{"name"=>"Accept-Ranges", "value"=>"bytes"}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"Content-Encoding", "value"=>"gzip"}, {"name"=>"Cross-Origin-Resource-Policy", "value"=>"cross-origin"}, {"name"=>"Cross-Origin-Opener-Policy-Report-Only", "value"=>"same-origin; report-to=\"static-on-bigtable\""}, {"name"=>"Report-To", "value"=>"{\"group\":\"static-on-bigtable\",\"max_age\":2592000,\"endpoints\":[{\"url\":\"https://csp.withgoogle.com/csp/report-to/static-on-bigtable\"}]}"}, {"name"=>"Content-Length", "value"=>"1494"}, {"name"=>"X-Content-Type-Options", "value"=>"nosniff"}, {"name"=>"Server", "value"=>"sffe"}, {"name"=>"X-XSS-Protection", "value"=>"0"}, {"name"=>"Date", "value"=>"Tue, 29 Nov 2022 16:15:38 GMT"}, {"name"=>"Expires", "value"=>"Wed, 07 Dec 2022 16:15:38 GMT"}, {"name"=>"Cache-Control", "value"=>"public, max-age=691200"}, {"name"=>"Last-Modified", "value"=>"Tue, 22 Oct 2019 18:30:00 GMT"}, {"name"=>"Content-Type", "value"=>"image/x-icon"}, {"name"=>"Age", "value"=>"29847"}], "networkId"=>"522.2"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket -> {:method=>"Fetch.continueRequest", :params=>{:requestId=>"interception-job-2.0"}, :sessionId=>"D67C4350695954D527234799C50D3F55", :id=>10}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"id"=>10, "result"=>{}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"method"=>"Network.responseReceived", "params"=>{"requestId"=>"522.2", "loaderId"=>"378A282A979910FF7A6D77C2E5AA348F", "timestamp"=>106874837.169647, "type"=>"Other", "response"=>{"url"=>"http://www.google.com/favicon.ico", "status"=>200, "statusText"=>"OK", "headers"=>{"Date"=>"Tue, 29 Nov 2022 16:15:38 GMT", "Content-Encoding"=>"gzip", "X-Content-Type-Options"=>"nosniff", "Age"=>"29847", "Cross-Origin-Resource-Policy"=>"cross-origin", "Content-Length"=>"1494", "X-XSS-Protection"=>"0", "Last-Modified"=>"Tue, 22 Oct 2019 18:30:00 GMT", "Server"=>"sffe", "Vary"=>"Accept-Encoding", "Report-To"=>"{\"group\":\"static-on-bigtable\",\"max_age\":2592000,\"endpoints\":[{\"url\":\"https://csp.withgoogle.com/csp/report-to/static-on-bigtable\"}]}", "Content-Type"=>"image/x-icon", "Cache-Control"=>"public, max-age=691200", "Accept-Ranges"=>"bytes", "Cross-Origin-Opener-Policy-Report-Only"=>"same-origin; report-to=\"static-on-bigtable\"", "Expires"=>"Wed, 07 Dec 2022 16:15:38 GMT"}, "mimeType"=>"image/x-icon", "connectionReused"=>true, "connectionId"=>88, "remoteIPAddress"=>"172.217.175.228", "remotePort"=>80, "fromDiskCache"=>false, "fromServiceWorker"=>false, "fromPrefetchCache"=>false, "encodedDataLength"=>654, "timing"=>{"requestTime"=>106874837.159402, "proxyStart"=>-1, "proxyEnd"=>-1, "dnsStart"=>-1, "dnsEnd"=>-1, "connectStart"=>-1, "connectEnd"=>-1, "sslStart"=>-1, "sslEnd"=>-1, "workerStart"=>-1, "workerReady"=>-1, "workerFetchStart"=>-1, "workerRespondWithSettled"=>-1, "sendStart"=>0.451, "sendEnd"=>0.542, "pushStart"=>0, "pushEnd"=>0, "receiveHeadersEnd"=>2.879}, "responseTime"=>1669768385010.631, "protocol"=>"http/1.1", "securityState"=>"insecure"}, "hasExtraInfo"=>true, "frameId"=>"EB9545DF25F68498F58B47FE04276770"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"method"=>"Network.dataReceived", "params"=>{"requestId"=>"522.2", "timestamp"=>106874837.169825, "dataLength"=>5430, "encodedDataLength"=>0}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"method"=>"Network.dataReceived", "params"=>{"requestId"=>"522.2", "timestamp"=>106874837.171651, "dataLength"=>0, "encodedDataLength"=>1494}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:05 DEBUG Selenium WebSocket <- {"method"=>"Network.loadingFinished", "params"=>{"requestId"=>"522.2", "timestamp"=>106874837.163961, "encodedDataLength"=>2148, "shouldReportCorbBlocking"=>false}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}
2022-11-30 09:33:25 INFO Selenium -> DELETE session/fd077ce42a9e5fd6a03e74f04241469f
2022-11-30 09:33:25 INFO Selenium <- {"value":null}
echoidcf commented 2 years ago

γ‚³γƒ‘γƒ³γƒˆ 2022-11-30 093322

echoidcf commented 2 years ago

Oh, another thing. I noticed that code in response object is string instead of a int. So, if I change the code from r.code = 200 to r.code = "200" and it just crashed.

2022-11-30 09:40:53 INFO Selenium -> POST session
2022-11-30 09:40:53 INFO Selenium    >>> http://localhost:4444/wd/hub/session | {"capabilities":{"alwaysMatch":{"browserName":"chrome"}}}
2022-11-30 09:40:53 DEBUG Selenium      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.6.1 (ruby linux)", "Content-Length"=>"57"}
2022-11-30 09:40:53 INFO Selenium <- {
  "value": {
    "sessionId": "a9b5fad0899a1b175ddff21e567660cd",
    "capabilities": {
      "acceptInsecureCerts": false,
      "browserName": "chrome",
      "browserVersion": "107.0.5304.87",
      "chrome": {
        "chromedriverVersion": "107.0.5304.62 (1eec40d3a5764881c92085aaee66d25075c159aa-refs\u002fbranch-heads\u002f5304@{#942})",
        "userDataDir": "\u002ftmp\u002f.com.google.Chrome.WUiVde"
      },
      "goog:chromeOptions": {
        "debuggerAddress": "localhost:39418"
      },
      "networkConnectionEnabled": false,
      "pageLoadStrategy": "normal",
      "platformName": "LINUX",
      "proxy": {
      },
      "se:bidiEnabled": false,
      "se:cdp": "ws:\u002f\u002f192.168.16.1:4444\u002fsession\u002fa9b5fad0899a1b175ddff21e567660cd\u002fse\u002fcdp",
      "se:cdpVersion": "107.0.5304.87",
      "se:vnc": "ws:\u002f\u002f192.168.16.1:4444\u002fsession\u002fa9b5fad0899a1b175ddff21e567660cd\u002fse\u002fvnc",
      "se:vncEnabled": true,
      "se:vncLocalAddress": "ws:\u002f\u002f192.168.16.1:7900",
      "setWindowRect": true,
      "strictFileInteractability": false,
      "timeouts": {
        "implicit": 0,
        "pageLoad": 300000,
        "script": 30000
      },
      "unhandledPromptBehavior": "dismiss and notify",
      "webauthn:extension:credBlob": true,
      "webauthn:extension:largeBlob": true,
      "webauthn:virtualAuthenticators": true
    }
  }
}
/home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/digest-3.1.0/lib/digest.rb:20: warning: already initialized constant Digest::REQUIRE_MUTEX
/home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/3.0.0/digest.rb:6: warning: previous definition of REQUIRE_MUTEX was here
2022-11-30 09:40:53 DEBUG Selenium WebSocket -> {:method=>"Target.getTargets", :params=>{}, :id=>1}
2022-11-30 09:40:53 DEBUG Selenium WebSocket <- {"id"=>1, "result"=>{"targetInfos"=>[{"targetId"=>"771F93CFC23C45282E14BBB8B00569CE", "type"=>"page", "title"=>"data:,", "url"=>"data:,", "attached"=>true, "canAccessOpener"=>false, "browserContextId"=>"97EA5794F358C7A28D0CC169B8184E0A"}]}}
2022-11-30 09:40:53 DEBUG Selenium WebSocket -> {:method=>"Target.attachToTarget", :params=>{:targetId=>"771F93CFC23C45282E14BBB8B00569CE", :flatten=>true}, :id=>2}
2022-11-30 09:40:53 DEBUG Selenium WebSocket <- {"method"=>"Target.attachedToTarget", "params"=>{"sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394", "targetInfo"=>{"targetId"=>"771F93CFC23C45282E14BBB8B00569CE", "type"=>"page", "title"=>"data:,", "url"=>"data:,", "attached"=>true, "canAccessOpener"=>false, "browserContextId"=>"97EA5794F358C7A28D0CC169B8184E0A"}, "waitingForDebugger"=>false}}
2022-11-30 09:40:53 DEBUG Selenium WebSocket <- {"id"=>2, "result"=>{"sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}}
2022-11-30 09:40:54 DEBUG Selenium WebSocket -> {:method=>"Network.setCacheDisabled", :params=>{:cacheDisabled=>true}, :sessionId=>"5FEEAD0368FA78C7C4E644CA8194A394", :id=>3}
2022-11-30 09:40:54 DEBUG Selenium WebSocket <- {"id"=>3, "result"=>{}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:40:54 DEBUG Selenium WebSocket -> {:method=>"Network.enable", :params=>{}, :sessionId=>"5FEEAD0368FA78C7C4E644CA8194A394", :id=>4}
2022-11-30 09:40:54 DEBUG Selenium WebSocket <- {"id"=>4, "result"=>{}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:40:54 DEBUG Selenium WebSocket -> {:method=>"Fetch.enable", :params=>{:patterns=>[{:requestStage=>"Request"}, {:requestStage=>"Response"}]}, :sessionId=>"5FEEAD0368FA78C7C4E644CA8194A394", :id=>5}
2022-11-30 09:40:54 DEBUG Selenium WebSocket <- {"id"=>5, "result"=>{}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:12 DEBUG Selenium WebSocket <- {"method"=>"Network.responseReceived", "params"=>{"requestId"=>"671.2", "loaderId"=>"0A8CF2E051D0C538436E79EB218594AB", "timestamp"=>106875324.605562, "type"=>"Other", "response"=>{"url"=>"data:,", "status"=>200, "statusText"=>"OK", "headers"=>{"Content-Type"=>"text/plain;charset=US-ASCII"}, "mimeType"=>"text/plain", "connectionReused"=>false, "connectionId"=>0, "fromDiskCache"=>false, "fromServiceWorker"=>false, "fromPrefetchCache"=>false, "encodedDataLength"=>0, "protocol"=>"data", "securityState"=>"unknown"}, "hasExtraInfo"=>false, "frameId"=>"771F93CFC23C45282E14BBB8B00569CE"}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:12 DEBUG Selenium WebSocket <- {"method"=>"Network.loadingFinished", "params"=>{"requestId"=>"671.2", "timestamp"=>106875324.605618, "encodedDataLength"=>0, "shouldReportCorbBlocking"=>false}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:14 INFO Selenium -> POST session/a9b5fad0899a1b175ddff21e567660cd/url
2022-11-30 09:41:14 INFO Selenium    >>> http://localhost:4444/wd/hub/session/a9b5fad0899a1b175ddff21e567660cd/url | {"url":"http://www.google.com/not_exist.html"}
2022-11-30 09:41:14 DEBUG Selenium      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.6.1 (ruby linux)", "Content-Length"=>"46"}
2022-11-30 09:41:14 DEBUG Selenium WebSocket <- {"method"=>"Network.requestWillBeSent", "params"=>{"requestId"=>"EEDDD32B0D9ACD0EE1DC12F32326B5F8", "loaderId"=>"EEDDD32B0D9ACD0EE1DC12F32326B5F8", "documentURL"=>"http://www.google.com/not_exist.html", "request"=>{"url"=>"http://www.google.com/not_exist.html", "method"=>"GET", "headers"=>{"Upgrade-Insecure-Requests"=>"1", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "mixedContentType"=>"none", "initialPriority"=>"VeryHigh", "referrerPolicy"=>"strict-origin-when-cross-origin", "isSameSite"=>true}, "timestamp"=>106875326.544089, "wallTime"=>1669768874.392573, "initiator"=>{"type"=>"other"}, "redirectHasExtraInfo"=>false, "type"=>"Document", "frameId"=>"771F93CFC23C45282E14BBB8B00569CE", "hasUserGesture"=>false}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:14 DEBUG Selenium WebSocket <- {"method"=>"Fetch.requestPaused", "params"=>{"requestId"=>"interception-job-1.0", "request"=>{"url"=>"http://www.google.com/not_exist.html", "method"=>"GET", "headers"=>{"Accept"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Upgrade-Insecure-Requests"=>"1", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "initialPriority"=>"VeryHigh", "referrerPolicy"=>"strict-origin-when-cross-origin"}, "frameId"=>"771F93CFC23C45282E14BBB8B00569CE", "resourceType"=>"Document", "networkId"=>"EEDDD32B0D9ACD0EE1DC12F32326B5F8"}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:14 DEBUG Selenium WebSocket -> {:method=>"Fetch.continueRequest", :params=>{:requestId=>"interception-job-1.0"}, :sessionId=>"5FEEAD0368FA78C7C4E644CA8194A394", :id=>6}
2022-11-30 09:41:14 DEBUG Selenium WebSocket <- {"id"=>6, "result"=>{}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:14 DEBUG Selenium WebSocket <- {"method"=>"Network.requestWillBeSentExtraInfo", "params"=>{"requestId"=>"EEDDD32B0D9ACD0EE1DC12F32326B5F8", "associatedCookies"=>[], "headers"=>{"Accept"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Accept-Encoding"=>"gzip, deflate", "Accept-Language"=>"en-US,en;q=0.9", "Cache-Control"=>"no-cache", "Connection"=>"keep-alive", "Host"=>"www.google.com", "Pragma"=>"no-cache", "Upgrade-Insecure-Requests"=>"1", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "connectTiming"=>{"requestTime"=>106875326.557081}}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:14 DEBUG Selenium WebSocket <- {"method"=>"Network.responseReceivedExtraInfo", "params"=>{"requestId"=>"EEDDD32B0D9ACD0EE1DC12F32326B5F8", "blockedCookies"=>[], "headers"=>{"Content-Length"=>"1575", "Content-Type"=>"text/html; charset=UTF-8", "Date"=>"Wed, 30 Nov 2022 00:41:14 GMT", "Referrer-Policy"=>"no-referrer"}, "resourceIPAddressSpace"=>"Public", "statusCode"=>404, "headersText"=>"HTTP/1.1 404 Not Found\r\nContent-Type: text/html; charset=UTF-8\r\nReferrer-Policy: no-referrer\r\nContent-Length: 1575\r\nDate: Wed, 30 Nov 2022 00:41:14 GMT\r\n\r\n"}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:14 DEBUG Selenium WebSocket <- {"method"=>"Fetch.requestPaused", "params"=>{"requestId"=>"interception-job-1.0", "request"=>{"url"=>"http://www.google.com/not_exist.html", "method"=>"GET", "headers"=>{"Accept"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Upgrade-Insecure-Requests"=>"1", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "initialPriority"=>"VeryHigh", "referrerPolicy"=>"strict-origin-when-cross-origin"}, "frameId"=>"771F93CFC23C45282E14BBB8B00569CE", "resourceType"=>"Document", "responseStatusCode"=>404, "responseStatusText"=>"Not Found", "responseHeaders"=>[{"name"=>"Content-Type", "value"=>"text/html; charset=UTF-8"}, {"name"=>"Referrer-Policy", "value"=>"no-referrer"}, {"name"=>"Content-Length", "value"=>"1575"}, {"name"=>"Date", "value"=>"Wed, 30 Nov 2022 00:41:14 GMT"}], "networkId"=>"EEDDD32B0D9ACD0EE1DC12F32326B5F8"}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:14 DEBUG Selenium WebSocket -> {:method=>"Fetch.getResponseBody", :params=>{:requestId=>"interception-job-1.0"}, :sessionId=>"5FEEAD0368FA78C7C4E644CA8194A394", :id=>7}
2022-11-30 09:41:14 DEBUG Selenium WebSocket <- {"id"=>7, "result"=>{"body"=>"PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ZW4+CiAgPG1ldGEgY2hhcnNldD11dGYtOD4KICA8bWV0YSBuYW1lPXZpZXdwb3J0IGNvbnRlbnQ9ImluaXRpYWwtc2NhbGU9MSwgbWluaW11bS1zY2FsZT0xLCB3aWR0aD1kZXZpY2Utd2lkdGgiPgogIDx0aXRsZT5FcnJvciA0MDQgKE5vdCBGb3VuZCkhITE8L3RpdGxlPgogIDxzdHlsZT4KICAgICp7bWFyZ2luOjA7cGFkZGluZzowfWh0bWwsY29kZXtmb250OjE1cHgvMjJweCBhcmlhbCxzYW5zLXNlcmlmfWh0bWx7YmFja2dyb3VuZDojZmZmO2NvbG9yOiMyMjI7cGFkZGluZzoxNXB4fWJvZHl7bWFyZ2luOjclIGF1dG8gMDttYXgtd2lkdGg6MzkwcHg7bWluLWhlaWdodDoxODBweDtwYWRkaW5nOjMwcHggMCAxNXB4fSogPiBib2R5e2JhY2tncm91bmQ6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2Vycm9ycy9yb2JvdC5wbmcpIDEwMCUgNXB4IG5vLXJlcGVhdDtwYWRkaW5nLXJpZ2h0OjIwNXB4fXB7bWFyZ2luOjExcHggMCAyMnB4O292ZXJmbG93OmhpZGRlbn1pbnN7Y29sb3I6Izc3Nzt0ZXh0LWRlY29yYXRpb246bm9uZX1hIGltZ3tib3JkZXI6MH1AbWVkaWEgc2NyZWVuIGFuZCAobWF4LXdpZHRoOjc3MnB4KXtib2R5e2JhY2tncm91bmQ6bm9uZTttYXJnaW4tdG9wOjA7bWF4LXdpZHRoOm5vbmU7cGFkZGluZy1yaWdodDowfX0jbG9nb3tiYWNrZ3JvdW5kOnVybCgvL3d3dy5nb29nbGUuY29tL2ltYWdlcy9icmFuZGluZy9nb29nbGVsb2dvLzF4L2dvb2dsZWxvZ29fY29sb3JfMTUweDU0ZHAucG5nKSBuby1yZXBlYXQ7bWFyZ2luLWxlZnQ6LTVweH1AbWVkaWEgb25seSBzY3JlZW4gYW5kIChtaW4tcmVzb2x1dGlvbjoxOTJkcGkpeyNsb2dve2JhY2tncm91bmQ6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2JyYW5kaW5nL2dvb2dsZWxvZ28vMngvZ29vZ2xlbG9nb19jb2xvcl8xNTB4NTRkcC5wbmcpIG5vLXJlcGVhdCAwJSAwJS8xMDAlIDEwMCU7LW1vei1ib3JkZXItaW1hZ2U6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2JyYW5kaW5nL2dvb2dsZWxvZ28vMngvZ29vZ2xlbG9nb19jb2xvcl8xNTB4NTRkcC5wbmcpIDB9fUBtZWRpYSBvbmx5IHNjcmVlbiBhbmQgKC13ZWJraXQtbWluLWRldmljZS1waXhlbC1yYXRpbzoyKXsjbG9nb3tiYWNrZ3JvdW5kOnVybCgvL3d3dy5nb29nbGUuY29tL2ltYWdlcy9icmFuZGluZy9nb29nbGVsb2dvLzJ4L2dvb2dsZWxvZ29fY29sb3JfMTUweDU0ZHAucG5nKSBuby1yZXBlYXQ7LXdlYmtpdC1iYWNrZ3JvdW5kLXNpemU6MTAwJSAxMDAlfX0jbG9nb3tkaXNwbGF5OmlubGluZS1ibG9jaztoZWlnaHQ6NTRweDt3aWR0aDoxNTBweH0KICA8L3N0eWxlPgogIDxhIGhyZWY9Ly93d3cuZ29vZ2xlLmNvbS8+PHNwYW4gaWQ9bG9nbyBhcmlhLWxhYmVsPUdvb2dsZT48L3NwYW4+PC9hPgogIDxwPjxiPjQwNC48L2I+IDxpbnM+VGhhdOKAmXMgYW4gZXJyb3IuPC9pbnM+CiAgPHA+VGhlIHJlcXVlc3RlZCBVUkwgPGNvZGU+L25vdF9leGlzdC5odG1sPC9jb2RlPiB3YXMgbm90IGZvdW5kIG9uIHRoaXMgc2VydmVyLiAgPGlucz5UaGF04oCZcyBhbGwgd2Uga25vdy48L2lucz4K", "base64Encoded"=>true}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
2022-11-30 09:41:14 DEBUG Selenium WebSocket -> {:method=>"Fetch.fulfillRequest", :params=>{:requestId=>"interception-job-1.0", :responseCode=>"200", :responseHeaders=>[{:name=>"Content-Type", :value=>"text/html; charset=UTF-8"}, {:name=>"Referrer-Policy", :value=>"no-referrer"}, {:name=>"Content-Length", :value=>"1575"}, {:name=>"Date", :value=>"Wed, 30 Nov 2022 00:41:14 GMT"}], :body=>"aW50ZXJjZXB0ZWQ="}, :sessionId=>"5FEEAD0368FA78C7C4E644CA8194A394", :id=>8}
2022-11-30 09:41:14 DEBUG Selenium WebSocket <- {"id"=>8, "error"=>{"code"=>-32602, "message"=>"Invalid parameters", "data"=>"Failed to deserialize params.responseCode - BINDINGS: int32 value expected at position 52"}, "sessionId"=>"5FEEAD0368FA78C7C4E644CA8194A394"}
#<Thread:0x0000000001120a88 /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/common/websocket_connection.rb:114 run> terminated with exception (report_on_exception is true):
/home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools.rb:49:in `send_cmd': -32602: Invalid parameters: Failed to deserialize params.responseCode - BINDINGS: int32 value expected at position 52 (Selenium::WebDriver::Error::WebDriverError)
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-devtools-0.107.0/lib/selenium/devtools/v107/fetch.rb:56:in `fulfill_request'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:147:in `mutate_response'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:125:in `intercept_response'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:86:in `block in request_paused'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:164:in `with_cancellable_request'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:83:in `request_paused'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:50:in `block in intercept'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/common/websocket_connection.rb:124:in `block in callback_thread'
/home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools.rb:49:in `send_cmd': -32602: Invalid parameters: Failed to deserialize params.responseCode - BINDINGS: int32 value expected at position 52 (Selenium::WebDriver::Error::WebDriverError)
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-devtools-0.107.0/lib/selenium/devtools/v107/fetch.rb:56:in `fulfill_request'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:147:in `mutate_response'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:125:in `intercept_response'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:86:in `block in request_paused'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:164:in `with_cancellable_request'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:83:in `request_paused'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/devtools/network_interceptor.rb:50:in `block in intercept'
        from /home/opsadmin/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/selenium-webdriver-4.6.1/lib/selenium/webdriver/common/websocket_connection.rb:124:in `block in callback_thread'
p0deje commented 2 years ago

You should not use strings for status codes so the crash is expected.

What looks off to me is that the response is intercepted correctly:

2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Fetch.requestPaused", "params"=>{"requestId"=>"interception-job-1.0", "request"=>{"url"=>"http://www.google.com/not_exist.html", "method"=>"GET", "headers"=>{"Accept"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Upgrade-Insecure-Requests"=>"1", "User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}, "initialPriority"=>"VeryHigh", "referrerPolicy"=>"strict-origin-when-cross-origin"}, "frameId"=>"EB9545DF25F68498F58B47FE04276770", "resourceType"=>"Document", "responseStatusCode"=>404, "responseStatusText"=>"Not Found", "responseHeaders"=>[{"name"=>"Content-Type", "value"=>"text/html; charset=UTF-8"}, {"name"=>"Referrer-Policy", "value"=>"no-referrer"}, {"name"=>"Content-Length", "value"=>"1575"}, {"name"=>"Date", "value"=>"Wed, 30 Nov 2022 00:33:04 GMT"}], "networkId"=>"378A282A979910FF7A6D77C2E5AA348F"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}

And when it's fulfilled, the response code is properly set to 200:

2022-11-30 09:33:04 DEBUG Selenium WebSocket -> {:method=>"Fetch.fulfillRequest", :params=>{:requestId=>"interception-job-1.0", :responseCode=>200, :responseHeaders=>[{:name=>"Content-Type", :value=>"text/html; charset=UTF-8"}, {:name=>"Referrer-Policy", :value=>"no-referrer"}, {:name=>"Content-Length", :value=>"1575"}, {:name=>"Date", :value=>"Wed, 30 Nov 2022 00:33:04 GMT"}], :body=>"aW50ZXJjZXB0ZWQ="}, :sessionId=>"D67C4350695954D527234799C50D3F55", :id=>8}

And then there is an event that response is received with a 200 code too:

2022-11-30 09:33:04 DEBUG Selenium WebSocket <- {"method"=>"Network.responseReceived", "params"=>{"requestId"=>"378A282A979910FF7A6D77C2E5AA348F", "loaderId"=>"378A282A979910FF7A6D77C2E5AA348F", "timestamp"=>106874837.113321, "type"=>"Document", "response"=>{"url"=>"http://www.google.com/not_exist.html", "status"=>200, "statusText"=>"OK", "headers"=>{"Content-Length"=>"1575", "Content-Type"=>"text/html; charset=UTF-8", "Date"=>"Wed, 30 Nov 2022 00:33:04 GMT", "Referrer-Policy"=>"no-referrer"}, "mimeType"=>"text/html", "connectionReused"=>false, "connectionId"=>0, "remoteIPAddress"=>"", "remotePort"=>0, "fromDiskCache"=>false, "fromServiceWorker"=>false, "fromPrefetchCache"=>false, "encodedDataLength"=>138, "timing"=>{"requestTime"=>106874836.967957, "proxyStart"=>-1, "proxyEnd"=>-1, "dnsStart"=>-1, "dnsEnd"=>-1, "connectStart"=>-1, "connectEnd"=>-1, "sslStart"=>-1, "sslEnd"=>-1, "workerStart"=>-1, "workerReady"=>-1, "workerFetchStart"=>-1, "workerRespondWithSettled"=>-1, "sendStart"=>-1, "sendEnd"=>-1, "pushStart"=>0, "pushEnd"=>0, "receiveHeadersEnd"=>142.869}, "responseTime"=>1669768384959.287, "protocol"=>"http/1.1", "securityState"=>"insecure"}, "hasExtraInfo"=>false, "frameId"=>"EB9545DF25F68498F58B47FE04276770"}, "sessionId"=>"D67C4350695954D527234799C50D3F55"}

So I suppose we do everything correctly and it's an issue in Chrome itself. I wonder if it happens because you open that URL directly...

diemol commented 1 year ago

Closing as we did not get more information.

github-actions[bot] commented 11 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.