Closed dmorgan-fa closed 1 year ago
Oh I see, could you please try to add check for a redirect status here, something like:
def subscribe_response_received
@page.on("Network.responseReceived") do |params|
exchange = select(params["requestId"]).last
if exchange
response = Network::Response.new(@page, params)
exchange.response = response
response.loaded = true if response.status is redirect # <<< HERE
end
end
end
and tell me if it works?
Thanks for the quick reply!
Unfortunately that doesn't seem to resolve it. Looks like we're stuck checking loaded?
:
def loaded?
if @loaded.nil?
puts params['request']['url'] if params['request']
puts params['redirectResponse']['status'] if params['redirectResponse']
end
@loaded
end
A little more debugging:
def subscribe_response_received
@page.on("Network.responseReceived") do |params|
exchange = select(params["requestId"]).last
if exchange
response = Network::Response.new(@page, params)
exchange.response = response
puts "#{response.status} - #{response.url}"
binding.pry if response.status != 200
binding.pry if params['redirectResponse']['status'] == 302
response.loaded = true if response.status is redirect
end
end
end
@dmorgan-fa As you already worked on this, is the proposed fix in https://github.com/rubycdp/ferrum/pull/328 making sense?
@francisbeaudoin, sorry for the delayed response.
I've just tested this and it does resolve the issue we were seeing, thanks!
We've since moved away from explicitly calling Cuprite's wait_for_network_idle
, but it's a good addition to fix the Ferrum library 👍
Hi, Firstly, thanks for the excellent work on this gem and Cuprite!
We've been looking into some reliability issues lately and trying different things. One thing that I've noticed, is a recent change:
now causes redirect requests to be considered still
pending
even though they've completed:Full Ferrum::Network::Exchange object here
``` #This output was from a forked branch with some extra logging:
Admittedly this is only seen when we're calling Cuprite's
wait_for_network_idle
directly within a spec (something we're looking to remove), but it looks like something that will trip Ferrum up ifwait_for_idle
gets called and there's been a redirect.