Git Product home page Git Product logo

Comments (10)

sindhubee avatar sindhubee commented on July 22, 2024 1

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.

tehhowch avatar tehhowch commented on July 22, 2024

The problem there is likely that you refreshed the page after you set up the interceptor.

from wdio-intercept-service.

sindhubee avatar sindhubee commented on July 22, 2024

@tehhowch Tried to remove the refresh and I still get the same empty array.

from wdio-intercept-service.

tehhowch avatar tehhowch commented on July 22, 2024

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:

index > -1 ? index : undefined,

and thus we enter this branch, returning all completed requests to the nodejs process
if (index == null) {
return includePending ? requests : requests.filter(isComplete);

and then since the return value is an array, this logic runs:
if (Array.isArray(request)) {
return request.map(transformRequest);

A PR that throws a TypeError for invalid index parameters would help catch this sooner, contributions are welcome.

from wdio-intercept-service.

sindhubee avatar sindhubee commented on July 22, 2024

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.

sindhubee avatar sindhubee commented on July 22, 2024

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 :

from wdio-intercept-service.

tehhowch avatar tehhowch commented on July 22, 2024

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.

sindhubee avatar sindhubee commented on July 22, 2024

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.

sindhubee avatar sindhubee commented on July 22, 2024

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.

sindhubee avatar sindhubee commented on July 22, 2024

@tehhowch Any update on this please?

from wdio-intercept-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.