Comments (10)
Turns out the network requests that i'm trying to intercept are not fetch/xhr type and hence i'm receiving an empty list. Closing this issue.
from wdio-intercept-service.
The problem there is likely that you refreshed the page after you set up the interceptor.
from wdio-intercept-service.
@tehhowch Tried to remove the refresh and I still get the same empty array.
from wdio-intercept-service.
If the code you've provided above is what is in your spec file, then this line is also to blame:
var request = await browser.getRequest({includingPending:true})
per the API for getRequest
, that should be getRequest(0, { includePending: true});
or you can use getRequests({ includePending: true });
if you want to receive all requests that have been logged so far and find the match in the nodejs process.
As for what is happening with the code you are using, you are passing {includePending: true}
as the index
property, which compares false
here:
wdio-intercept-service/index.js
Line 283 in 273ac93
and thus we enter this branch, returning all completed requests to the nodejs process
wdio-intercept-service/lib/interceptor.js
Lines 393 to 394 in 273ac93
and then since the return value is an array, this logic runs:
wdio-intercept-service/index.js
Lines 294 to 295 in 273ac93
A PR that throws a TypeError
for invalid index
parameters would help catch this sooner, contributions are welcome.
from wdio-intercept-service.
Hi @tehhowch Thank you for your inputs. I tried using getRequests({ includePending: true });
but I'm still not getting any traffic.
Adding a note here - Im running the app but pointing to localhost. Could this be an issue? If yes, are there any workarounds that you could suggest.
from wdio-intercept-service.
Adding more context - When i try to intercept a public page like "https://google.com" i'm seeing traffic, which for me seems like it is an issue intercepting localhost. I also tried the following with no luck :
- Changed localhost:8080 to localhost.:8080
- Used ip address http://127.0.0.1:8080
from wdio-intercept-service.
Hi @tehhowch Thank you for your inputs. I tried using
getRequests({ includePending: true });
but I'm still not getting any traffic.Adding a note here - Im running the app but pointing to localhost. Could this be an issue? If yes, are there any workarounds that you could suggest.
localhost is not an issue; this service's tests intercept traffic on localhost. Please verify the versions of WebdriverIO and of this service that you are using, as you have not provided that critical information.
from wdio-intercept-service.
Hi @tehhowch I'm using WebdriverIO version 8.3.5 and wdio-intercept-service version 4.3.1
Adding this info to the ticket description as well.
from wdio-intercept-service.
Also at times i keep getting this error
[0-0] 2023-02-27T04:04:54.648Z WARN webdriver: Request failed with status 500 due to javascript error: Failed to read the 'sessionStorage' property from 'Window': Storage is disabled inside 'data:' URLs. [0-0] JavaScript stack: [0-0] Error: Failed to read the 'sessionStorage' property from 'Window': Storage is disabled inside 'data:' URLs. [0-0] at supportsSessionStorage (eval at executeAsyncScript (:552:26), <anonymous>:255:23) [0-0] at setup (eval at executeAsyncScript (:552:26), <anonymous>:18:9) [0-0] at eval (eval at executeAsyncScript (:552:26), <anonymous>:324:6) [0-0] at eval (eval at executeAsyncScript (:552:26), <anonymous>:325:4) [0-0] at executeAsyncScript (<anonymous>:552:47) [0-0] at <anonymous>:567:29 [0-0] at callFunction (<anonymous>:446:22) [0-0] at <anonymous>:460:23 [0-0] at <anonymous>:461:3 [0-0] (Session info: chrome=110.0.5481.177)
from wdio-intercept-service.
@tehhowch Any update on this please?
from wdio-intercept-service.
Related Issues (20)
- Transition package from CJS to ESM HOT 3
- After updating to 4.3.0, attempting to get the network response when a filter is applied results in an error "Cannot read property trim of undefined" HOT 10
- (Version 4.2.2) Occasionally getting a java heap space error when running the network intercept too often HOT 1
- [Version 4.2.2] browser.disableInterceptor() is not a function HOT 1
- browser.getRequests() hanging without @wdio/sync module HOT 15
- Best practices with the wdio intercept service HOT 2
- Interceptor results are inconsistent
- Is there a way to abort the request? HOT 4
- Exception in .getRequests HOT 3
- Getting pending requests too HOT 1
- Intercepting segmentio messages HOT 5
- Not able to capture some api's called on Submit action HOT 4
- Cannot read property 'addCommand' of undefined HOT 11
- Does getRequests() capture all the 'GET' calls in the network log? HOT 2
- can we have support async/await for wdio-intercept-service HOT 7
- wdio-intercept-service is not capturing requests invoked in iframe HOT 6
- Cypress does not intercept graphql query HOT 2
- Other request types not being collected HOT 7
- Getting [wdio-intercept-service]: the "index" property must be a non-negative integer error while trying to capture GET request HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wdio-intercept-service.