Comments (5)
Hey could you maybe post more code?
Is the request done when the website loads (i.e. before the first user interaction)?
from wdio-intercept-service.
Hi, I created a sample scenario which resulted in the same issue
- Defined a feature file as below
Feature: Use Interceptor demo
Scenario: Use Interceptor
Given I open some home page and set interceptor
When I make browser to navigate to another url
Then I should see the interceptor working
- Defined the code as below
const { Given, When, Then} = require('cucumber');
var chai = require('chai');
//var request = require('request-promise');
//const { get, post } = require('request-promise');
Given(/^I open some home page and set interceptor$/,function(){
//browser.setupInterceptor(); this failed with error. "javascript error: Failed to read the 'sessionStorage' property from 'Window': Storage is disabled inside 'data:' URLs.""
browser.url('https://www.google.com/');
browser.pause(1000);
browser.setupInterceptor();
})
When(/^I make browser to navigate to another url$/,function(){
browser.url('https://www.google.co.in/');
browser.pause(1000);
console.log(browser.getRequests()); //this also returned empty array "[]"
console.log(browser.getRequest(0)); //this has thrown error "Could not find request with index 0"
})
Then(/^I should see the interceptor working$/,function(){
chai.expect(browser.getRequests().length > 0).to.be.true(); //this failed
console.log('over');
})
Thank you for the help.
from wdio-intercept-service.
Yep, this is exactly the right behaviour. The interceptor can only watch on Ajax and fetch requests after any user interaction. In this case there is no user interaction (and probably not even ajax requests).
from wdio-intercept-service.
Maybe I can try to help you here. What exactly are you trying to achieve?
from wdio-intercept-service.
@anbusivam : Did it resolve, if so could you kindly let me know?
@chmanie: I was trying the similar scenario,browser is making API calls but only for some executions browser.getRequests is returning the values rest it is returning [], basically results are inconsistent
Tried the below options, but not having the consistency in results. So I assume it should be something with the pause.
- With the version wdio-intercept-service version 4.2.1 and 4.2.2
- With browser.getRequest({includingPending:true})
Any thoughts?
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
- No request(empty array) returned from intercept service HOT 10
- 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.