Git Product home page Git Product logo

Comments (15)

tehhowch avatar tehhowch commented on June 24, 2024 2

"wdio-selenium-standalone-service": "~0.0.12",

that package is long-abandoned: https://github.com/webdriverio-boneyard/wdio-selenium-standalone-service

If you need both that and the chromedriver service installed, you should use @wdio/selenium-standalone-service instead.

from wdio-intercept-service.

tehhowch avatar tehhowch commented on June 24, 2024 1

@tehhowch I tried the sequence below now instead of duration waits. await browser.hasPendingRequests(); const requests = await browser.getRequests({includePending: true}); It works more consistently. Thanks. Then when I examine each of the requests and its response.statusCode, the response area is not available. Is there a wait I can do for the request to complete? This is not very critical for our application, but it is something we used to do.

The response is only available when the request is not pending. So your code should be more like

while (await browser.hasPendingRequests()) {
  // spin loop
}
const requests = await browser.getRequests();

and then there will not be any pending requests in requests array.

from wdio-intercept-service.

christian-bromann avatar christian-bromann commented on June 24, 2024

Hey @ksubramanian2 , thanks for filing an issue.

Do you have a reproducible example?

from wdio-intercept-service.

ksubramanian2 avatar ksubramanian2 commented on June 24, 2024

Thanks, @christian-bromann, for the quick response. I do not have an example to share readily. Our repo is in our intranet.
I can put an example together.
Are there any guesses on what I could be missing, in the meanwhile?

from wdio-intercept-service.

tehhowch avatar tehhowch commented on June 24, 2024

@ksubramanian2 This service does not require the wdio/sync module in any manner (you can see from its package.json that wdio/sync is not present, and also that its own plugin tests are written for the required-async future of WebdriverIO).

Please ensure you provide the version of the service that you are using, and whether the issue is present in other recent versions, too, or e.g. only the latest.

I expect the issue is related to your environment in some manner, e.g. some issue in the layers beneath the WebdriverIO abstraction. As Christian mentions, more details are necessary.

from wdio-intercept-service.

ksubramanian2 avatar ksubramanian2 commented on June 24, 2024

Thanks for the response, @tehhowch
I copied. the dependencies' versions from this repo into my package.json now. Below is what I have:
"@wdio/cli":"^7.16.3",
"@wdio/local-runner":"^7.16.3",
"@wdio/mocha-framework":"^7.16.3",
"@wdio/spec-reporter":"^7.16.3",
"@wdio/static-server-service": "^7.16.3",,
"chromedriver": "^106.0.1",
"wdio-chromedriver-service": "^8.0.0",
"wdio-docker-service": "3.2.0",
"wdio-intercept-service": "^4.2.2", // Also had tried with 4.3.0
"wdio-selenium-standalone-service": "~0.0.12",
"webdriverio": "^7.16.3",

I am using only local chrome for testing - Chrome 107. (Tried also with Selenium)
The config file is:
const { config: baseConfig } = require('./wdio.base.config');
exports.config = Object.assign(baseConfig, {
debug: 'true',
capabilities: [
{
browserName: 'chrome',
browserVersion: '107'
}
],
services: ['intercept', 'chromedriver']
});

node v 16.13.0

In the file where I do 'browser.getRequests()', I do not have any special imports for this.
Anything more needed?
If the issue cannot be identified from the above , I will create a reproduction repo.

from wdio-intercept-service.

christian-bromann avatar christian-bromann commented on June 24, 2024

Anything more needed?
If the issue cannot be identified from the above , I will create a reproduction repo.

A reproduction repo would be the best here.

from wdio-intercept-service.

ksubramanian2 avatar ksubramanian2 commented on June 24, 2024

@christian-bromann, I have recreated the situation in this repo here
Can you please hep?

from wdio-intercept-service.

ksubramanian2 avatar ksubramanian2 commented on June 24, 2024

@christian-bromann, I have recreated the situation in this repo here
This is what I could observe so far. Before, if I performed a click, paused a few millisecs and then call getRequests(), I could see the network requests. No longer the case now. Now it just hangs. Without the pause, getRequests() works but returns zero network calls. I thought I had seen the requests reported a couple of times with the pause being there , but cannot get it any more.

from wdio-intercept-service.

ksubramanian2 avatar ksubramanian2 commented on June 24, 2024

@christian-bromann, I have recreated the situation in this repo here
This is what I could observe so far. Before the upgrades, if I performed a click, paused a few milli-secs and then call getRequests(), I could see the network requests. No longer the case after the upgrades.

The reproduction repo is a simple test. Opens Google search, enters a search text and looks for network calls.
In this there is a 'await browser,pause()' before 'await browser.getRequests()'
Without the browser.pause before it, getRequests() works but returns zero network calls - expected.
With a pause of 1 second, it always works - returns four network calls.
With a pause of 5 seconds, getRequests() hangs and times out.
Now , there is some dependency of getRequests() on browser.pause that is not clear to me.
Appreciate your help in looking at this.

from wdio-intercept-service.

ksubramanian2 avatar ksubramanian2 commented on June 24, 2024

Further update.
This test works Ok in Safari without the getRequests( ) hanging.
The issue happens only in the latest Chrome v107, likely.

from wdio-intercept-service.

ksubramanian2 avatar ksubramanian2 commented on June 24, 2024

@christian-bromann
I had created the reproduction repo as requested by you. Appreciate ay insights you can provide.
After cloning the repo and yarn, please run 'yarn test'. Will not take more than five minutes of your time. Thanks.
https://github.com/ksubramanian2/intercepttest

from wdio-intercept-service.

tehhowch avatar tehhowch commented on June 24, 2024

@ksubramanian2 Do you need this line in your config?
https://github.com/ksubramanian2/intercepttest/blob/813f44b382e185d7ad4248bdacf7e296b585ca75/config.js#L31

FWIW I can run this just fine on macOS with Chrome 107, even with that sync: true line.

intercepttest (master)$ yarn test
yarn run v1.22.18
warning package.json: "test" is also the name of a node core module
$ wdio run config.js --spec test.js

Execution of 1 workers started at 2022-11-08T22:55:28.372Z

[0-0] RUNNING in chrome - /test.js
[0-0] entering getRequests
[0-0] returned from getRequests
[0-0] requests count = 3
[0-0] PASSED in chrome - /test.js

 "spec" Reporter:
------------------------------------------------------------------
[chrome 107.0.5304.87 mac os x #0-0] Running: chrome (v107.0.5304.87) on mac os x
[chrome 107.0.5304.87 mac os x #0-0] Session ID: 1a02e0434dd25d01ca867913515bae36
[chrome 107.0.5304.87 mac os x #0-0]
[chrome 107.0.5304.87 mac os x #0-0] » /test.js
[chrome 107.0.5304.87 mac os x #0-0] intercept test
[chrome 107.0.5304.87 mac os x #0-0]    ✓ getRequests test
[chrome 107.0.5304.87 mac os x #0-0]
[chrome 107.0.5304.87 mac os x #0-0] 1 passing (8.6s)


Spec Files:	 1 passed, 1 total (100% completed) in 00:00:18 

✨  Done in 20.34s.
intercepttest (master)$ node --version
v16.18.1
intercepttest (master)$ yarn wdio --version
yarn run v1.22.18
warning package.json: "test" is also the name of a node core module
$ /Users/bhauch/apps/intercepttest/node_modules/.bin/wdio --version
7.25.4
✨  Done in 0.99s.

PS: you don't need to do arbitrary waits any more, the service provides the capability to build your own "pending request waiter" via the browser.hasPendingRequests() method. My team's implementation is very simple, and alternates waiting 50 milliseconds with polling that method. Once there are no more pending requests, then the getRequests() call is made, ordering the requests by their start time.

from wdio-intercept-service.

ksubramanian2 avatar ksubramanian2 commented on June 24, 2024

Thanks, @tehhowch
I will check out the hasPendingRequests method.
When I run the code, I get the following:
[0-0] RUNNING in chrome - /test.js
[0-0] entering getRequests
[0-0] Error in "intercept test.getRequests test"
Error: Timeout of 20000ms exceeded. The execution in the test "intercept test getRequests test" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts). (/Users/ksubramanian3/Documents/projects/intercepttest/test.js)
at createTimeoutError (/Users/ksubramanian3/Documents/projects/intercepttest/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/ksubramanian3/Documents/projects/intercepttest/node_modules/mocha/lib/runnable.js:431:10)

Sometimes, I get:
Execution of 1 workers started at 2022-11-08T23:14:19.517Z

[0-0] RUNNING in chrome - /test.js
[0-0] entering getRequests
[0-0] 2022-11-08T23:14:40.109Z ERROR webdriver: Request failed with status 404 due to no such window: no such window: target window already closed
[0-0] from unknown error: web view not found
[0-0] (Session info: chrome=107.0.5304.87)
[0-0] no such window in "intercept test.getRequests test"
no such window: no such window: target window already closed
from unknown error: web view not found
(Session info: chrome=107.0.5304.87)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async getRequest (/Users/ksubramanian3/Documents/projects/intercepttest/node_modules/wdio-intercept-service/index.js:281:23)

from wdio-intercept-service.

ksubramanian2 avatar ksubramanian2 commented on June 24, 2024

@tehhowch
I tried the sequence below now instead of duration waits.
await browser.hasPendingRequests();
const requests = await browser.getRequests({includePending: true});
It works more consistently. Thanks.
Then when I examine each of the requests and its response.statusCode, the response area is not available.
Is there a wait I can do for the request to complete?
This is not very critical for our application, but it is something we used to do.

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.