Open tbardiuk-ua opened 1 year ago
I enabled logging and found out that the problem is with this line, which calls continue on an intercepted request before we call abort. As a result, when we call abort, we get back an "Invalid state for continueInterceptedRequest" error.
Until this is fixed, the workaround is to do the following:
browser = Ferrum::Browser.new(proxy: { host: 'host.com', port: '80' }, headless: false)
browser.network.authorize(user: 'username', password: 'password', type: :proxy) {}
browser.network.intercept
browser.on(:request) do |request|
if request.resource_type == 'Image'
request.abort
else
request.continue
end
end
browser.go_to('https://bing.com')
This ensures that the line I linked to isn't called, while still enabling authorization, but passing through an empty block to authorize that doesn't call request.continue.
Thank you guys for reporting and for findings, I’ll get back to you after investigation
I ran into this issue as well with proxies. Thank you for the tip on how to solve it
Hi guys. I'm trying to reduce traffic usage by not loading images. However, it seems that intercepted requests cannot be aborted when a proxy is used.
Here's an example:
The result is a page with no images loaded, so everything works as expected. But if I just change the browser options by adding a proxy, all the images will load:
I also checked if the
on(:request)
block is executed at all, and yes, it is. Butrequest.abort
doesn't seem to do anything.Does anyone have any idea why this is happening and how to fix the problem?
Thanks in advance.