Closed DPGZl closed 7 months ago
btw, I didn't call before
and beforeTest
/ beforeScenario
functions manually, could you give a suggestion how to call these functions manually?
webdriverajax
is an old version of this library, and you should not attempt to use both it and wdio-intercept-service
at the same time. You also shouldn't need to invoke before
/ beforeScenario
manually, they should be invoked by the local runner automatically if you have configured the service in wdio.conf.js
correctly.
@chmanie can we get webdriverajax
archived?
also @DPGZl , what version of WebdriverIO are you using?
Yup, I'll archive it asap.
Hi @tehhowch, thanks for your response, according to your suggestion I've removed webdriverajax
from my project, and I config as services: ['intercept']
, but I still run into the same error.
I'm not using webdriverio
directly, instead below are the wdio related packages I'm using:
"@wdio/cli": "6.0.16",
"@wdio/junit-reporter": "^6.3.6",
"@wdio/local-runner": "6.0.16",
"@wdio/mocha-framework": "6.0.16",
"@wdio/selenium-standalone-service": "6.0.16",
"@wdio/spec-reporter": "6.0.16",
"wdio-chromedriver-service": "6.0.4",
"wdio-intercept-service": "^4.3.1",
Please upgrade from v6 to v7. The signature of the before
hook changed, and the 3rd argument is now the browser object. In v6 and earlier, there is no third argument and thus the browser
parameter is undefined
, and shadows the global browser
. This has been broken since 4cb8d0dd6bec09dffb83b06a5712c31cad91e994, apparently.
If you cannot upgrade to the current LTS or higher, please open a PR to this repo that changes the "before" hook in index.js
to use either the provided 3rd argument or the global, depending on the presence of the argument.
e.g.
before() {
const browser = typeof arguments[2] === 'undefined' ? globalThis.browser : arguments[2];
//...rest is unmodified
You don't actually have to upgrade to v7, v6.10 will suffice, as that is when the change was made to start providing browser
to the before hook: https://github.com/webdriverio/webdriverio/commit/22ee02826afbb57e2c3bf8bacaa76917f2e78e40
@tehhowch , you mean I need to update @wdio/cli
to v6.10? (not webdriverio
, right? because I'm using @wdio/cli
.)
I've tried to update @wdio/cli
to v6.10, but the issue still exists.
The issue is resolved when I tried to debug on my local like the example you list above, so I'm wondering if it's ok to open a PR.
@tehhowch , you mean I need to update
@wdio/cli
to v6.10? (notwebdriverio
, right? because I'm using@wdio/cli
.)I've tried to update
@wdio/cli
to v6.10, but the issue still exists.The issue is resolved when I tried to debug on my local like the example you list above, so I'm wondering if it's ok to open a PR.
To update your WDIO packages, you should modify all @wdio/**
entries in your package.json to be ^6.10
and then run npm i
or yarn
, etc.
@wdio/local-runner
will be the most important one as that is the part of the framework that is running the tests and invoking the hooks, which is where the issue is occurring.
And yes, feel free to open a PR (with a test!) that restores support for WDIO 5.x, <6.10.
@DPGZl were you interested in contributing the fix?
I've addressed this in 210fdfcfe8a7fcdd3f8fc48d083b164424a4cffb
I'll create a new release in the next few days.
4.4.1 is available in NPM now
Hi, can anyone help me with this issue?
I wanna get a request header by Intercept Service, but I got this error:
ERROR @wdio/utils:shim: TypeError: Cannot read property 'addCommand' of undefined at WebdriverAjax.before
, I've tried to find the solution but nothing got.Here is the related packages version:
"wdio-chromedriver-service": "6.0.4", "wdio-intercept-service": "^4.3.1", "webdriverajax": "^2.2.0"