-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Open
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-rbRuby BindingsRuby BindingsI-defectSomething is not working as intendedSomething is not working as intended
Description
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
Mac
Selenium version
4.10
What are the browser(s) and version(s) where you see this issue?
chrome133
What are the browser driver(s) and version(s) where you see this issue?
chromedriver133
Are you using Selenium Grid?
NO
Metadata
Metadata
Assignees
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-rbRuby BindingsRuby BindingsI-defectSomething is not working as intendedSomething is not working as intended