-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for browser.on(:response)
.
#294
base: main
Are you sure you want to change the base?
Conversation
@route would appreciate some guidance on this new feature and where I should add the specs and documentation? |
@postmodern I was reorganizing specs so currently page specs are in the browser_spec. I think we can create page_spec and put it there. Though it overlaps with network_spec a bit, because |
I can't say for certain, but I believe the act of enabling network intercept requires you to authorize the requests to proceed. For example, some of the specs show: https://github.com/rubycdp/ferrum/blob/main/spec/network/exchange_spec.rb#L28 network.intercept
page.on(:request) { |r, _, _| r.continue } |
@ttilberg hmm that solved the exception, except now it does not appear that my |
@postmodern I took a look but didn’t find a CDP event translation helper for Edit: haha… I just looked at the rest of the context of this issue… lol. I’ll see myself out! |
@ttilberg yeah it's added in this PR. Feel free to pull my branch and try to mess with it. I swear it was working last year. |
OK I added some echo debugging and the |
* This adds an additional callback for the `Network.responseReceived` event when a response is received. It will look up the `Ferrum::Network::Exchange` object with the matching `requestId` and passes it back to the block, once a response has been received for a request.
152874a
to
ff5bf72
Compare
Got it, I needed to do |
I wanted to be able to have a callback similar to
on(:request)
but triggered once a response was received. This adds an additional callback for theNetwork.responseReceived
event when a response is received. It will look up theFerrum::Network::Exchange
object with the matchingrequestId
and passes it back to the block, once a response has been received for a request.I didn't know where to add specs for this, since there does not appear to be specs for
Ferrum::Page
or aspec/page_spec.rb
file? I also didn't know where I should mentionbrowser.on(:response)
in the README, sincebrowser.on(...)
is only mentioned in conjunction to usingbrowser.network.intercept
.