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:
browser = Ferrum::Browser.new(headless: false)
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')
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:
browser = Ferrum::Browser.new(proxy: { host: 'host.com', port: '80', user: 'username', password: 'password' }, headless: false)
I also checked if the on(:request) block is executed at all, and yes, it is. But request.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.
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.abortdoesn't seem to do anything.Does anyone have any idea why this is happening and how to fix the problem?
Thanks in advance.