Open ctm-adamstribblehill opened 1 year ago
I have a similar requirement. To be able to intercept the requests that are generated by beacon calls (navigator.sendBeacon() method) that are of type "ping".
I assume that https://github.com/webdriverio-community/wdio-intercept-service/blob/main/lib/interceptor.js needs to have a replaceSendBeacon implementation likewise fetch and Xhr ones.
Cypress is already supporting it so I was wondering if there is any plan to add support in the near future.
I have a similar requirement. To be able to intercept the requests that are generated by beacon calls (navigator.sendBeacon() method) that are of type "ping".
I assume that https://github.com/webdriverio-community/wdio-intercept-service/blob/main/lib/interceptor.js needs to have a replaceSendBeacon implementation likewise fetch and Xhr ones.
Cypress is already supporting it so I was wondering if there is any plan to add support in the near future.
Indeed, we would need an IE-parsable (does not have to support IE, just be parsed by it) implementation of such. A PR contributing (& testing!) that functionality would be appreciated.
@ctm-adamstribblehill I would need to see the code that triggers the request, not the request details. For example, if the initiating code uses a private reference to fetch
or XMLHttpRequest
and does not look it up from the window, this library is not able to intercept the request.
@tehhowch This request is not directly initiated / triggered by any code that we develop.
We have a tag management system (Tealium IQ), we configure Tealium to activate the Facebook Pixel tag deployed to the page via Tealium when the appropriate conditions are met and a Tealium event is emitted. This then results in the Facebook network request to be transmitted as attached above.
I have been able to collect other network requests emitted via Tealium such as a Yahoo Dot request but this is an XHR request.
@ctm-adamstribblehill reading more closely this time, I see you are basically asking about intercepting requests made by the browser itself for e.g. the src
attribute of an <image>
tag. That is not currently possible with this WDIO library, because those requests do not use the fetch
or XMLHttpRequest
objects. See https://github.com/webdriverio-community/wdio-intercept-service/issues/79 for an existing issue like this.
I do not expect support to be added for non-JS requests, either, since it would (AFAICT) require protocol-level interception and this library provides functionality in all modern browsers, not just those that extend Chromium.
You will probably need to switch to some other interception library that offers tie-ins with the chrome dev tools / puppeteer.
(I welcome any corrections to my assumptions above!)
Hello @tehhowch,
I have raised a PR to add support for intercepting queued beacon requests at https://github.com/webdriverio-community/wdio-intercept-service/pull/651
Would love to assist and get this in the next release. For the time being I unblocked myself using patch-package with the same changes.
On a sidenote, the prettier pre-push check fails with existing code from main you might want to auto format the code base once at some point.
Thanks for the great package!
hey guys, we're seeing the same issue and are unable to retrieve analytics request of type 'ping'. any news of when will this be supported?
btw thanks for the package.
Hi
I am using WebDriverIO to perform end to end testing of customer journeys, at certain points our tag management system initiates network requests to endpoints such as Google Analytics 4, Floodlights, Facebook, etc.
We would like to be able to test / check the requests emitted contain the correct data however when calling
await browser.getRequests()
they are not returned. I believe this is because they are notfetch
orXHR
request types, is this correct?And if this is correct is there expected to be any future releases to allow such monitoring / capture to occur.
Below is an example of a request being sent that WebDriverIO is not picking up.