nightwatch-api
nightwatch-api copied to clipboard
Nightwatch 1.7.3 : Cannot read property 'catch' of undefined on useXpath() or useCss()
Describe the bug
After updating to Nightwatch 1.7.3, useXpath() or useCss() return error Cannot read property 'catch' of undefined.
I have these functions in my tests because there were some issues and the element locator wasn't recognized without them. I am using nightwatch-api with cucumber runner
I reported the same bug at Nightwatch side, but as per their advice I am reporting it here
Sample test
sampleTest.js
// Please add the sample test here
module.exports = {
sampleTest: function(browser) {
this.useCss();
await this.waitForElementVisible(element);
}
}
Run with command
$ nightwatch test/sampleTest.js --your-other-arguments-here
Verbose output
debug.log
- Connecting to 127.0.0.1 on port 4444...
\ Connecting to 127.0.0.1 on port 4444...
Response 200 POST /session (841ms)
{
sessionId: '61bcf11b6178e6bb0c6a1f2cb0ff5d38',
status: 0,
value: {
acceptInsecureCerts: false,
acceptSslCerts: false,
applicationCacheEnabled: false,
browserConnectionEnabled: false,
browserName: 'chrome',
chrome: {
chromedriverVersion: '91.0.4472.101 (af52a90bf87030dd1523486a1cd3ae25c5d76c9b-refs/branch-heads/4472@{#1462})',
userDataDir: '\\AppData\\Local\\Temp\\scoped_dir25656_1293520567'
},
cssSelectorsEnabled: true,
databaseEnabled: false,
'goog:chromeOptions': { debuggerAddress: 'localhost:63620' },
handlesAlerts: true,
hasTouchScreen: false,
javascriptEnabled: true,
locationContextEnabled: true,
mobileEmulationEnabled: false,
nativeEvents: true,
networkConnectionEnabled: false,
pageLoadStrategy: 'normal',
platform: 'Windows',
proxy: {},
rotatable: false,
setWindowRect: true,
strictFileInteractability: false,
takesHeapSnapshot: true,
takesScreenshot: true,
timeouts: { implicit: 0, pageLoad: 300000, script: 30000 },
unexpectedAlertBehaviour: 'ignore',
version: '91.0.4472.124',
webStorageEnabled: true,
'webauthn:extension:largeBlob': true,
'webauthn:virtualAuthenticators': true
}
i Connected to 127.0.0.1 on port 4444 (904ms).
Using: chrome (91.0.4472.124) on Windows platform.
Received session with ID: 61bcf11b6178e6bb0c6a1f2cb0ff5d38
→ Running command: url ('https:...')
Request POST /session/61bcf11b6178e6bb0c6a1f2cb0ff5d38/url
{ url: 'https://...' }
Response 200 POST /session/61bcf11b6178e6bb0c6a1f2cb0ff5d38/url (2357ms)
{
sessionId: '61bcf11b6178e6bb0c6a1f2cb0ff5d38',
status: 0,
value: null
}
→ Completed command: url ('https://...') (2364ms)
→ Running command: clearValue ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout, retryInterval, message})
Request POST /session/61bcf11b6178e6bb0c6a1f2cb0ff5d38/elements
{ using: 'css selector', value: '#textField_name' }
Response 200 POST /session/61bcf11b6178e6bb0c6a1f2cb0ff5d38/elements (42ms)
{
sessionId: '61bcf11b6178e6bb0c6a1f2cb0ff5d38',
status: 0,
value: [ { ELEMENT: '0.22559923879828325-1' } ]
}
Request POST /session/61bcf11b6178e6bb0c6a1f2cb0ff5d38/element/0.22559923879828325-1/clear
{}
Response 200 POST /session/61bcf11b6178e6bb0c6a1f2cb0ff5d38/element/0.22559923879828325-1/clear (77ms)
{
sessionId: '61bcf11b6178e6bb0c6a1f2cb0ff5d38',
status: 0,
value: null
}
→ Completed command: clearValue ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout, retryInterval, message}) (133ms)
→ Running command: waitAndClick ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout, retryInterval, message})
→ Running command: useCss ()
TypeError: Cannot read property 'catch' of undefined
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
→ Running command: waitForElementVisible ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout, retryInterval, message})
Request POST /session/61bcf11b6178e6bb0c6a1f2cb0ff5d38/elements
{ using: 'css selector', value: '#textField_name' }
Cannot write log file to \nightwatch\chromedriver.log.
Error: EPERM: operation not permitted, open '\nightwatch\chromedriver.log'
npm ERR! Test failed. See above for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:localChrome: `cross-env NIGHTWATCH_ENV=localChrome npm test "--" "--tags" "@3"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:localChrome script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:AppData\Roaming\npm-cache\_logs\2021-07-21T12_01_29_597Z-debug.log
Configuration
nightwatch.json
{
"your": { "config": "here" }
}
Your Environment
| Executable | Version |
|---|---|
nightwatch --version |
1.7.3 |
npm --version |
6.14.13 |
cucumber--version |
6.0.5 |
nightwatch-api--version |
3.0.2 |
| Browser driver | Version |
|---|---|
| NAME | VERSION |
| OS | Version |
|---|---|
| NAME | VERSION |
Hi @ituradastra thank you for reporting this. Please note that this may take a while to investigate this issue. If you are able to investigate and find a root cause, Please free to update it here.
Hi there, we got the same issue with our Nightwatch setup. We are using Nightwatch API with Cucumber to run our feature files and after upgrading from Nightwatch 1.6.4 to 1.7.8 we saw these exact errors appearing.
Any news about this @spnraju? We've been facing the same issue and are forced to use a lower Nightwatch version because of this.