TypeError: Cannot read property 'length' of undefined when run test by cypress run
See original GitHub issueCurrent behavior:
I have testing site with shadow DOM.
it('test', () => {
cy
.get('div[class="oneAppNavContainer"]')
.find('one-appnav')
.find('span[title=" Config"]', {includeShadowDom: true})
.contains(' Config');
});
It’s code work correctly when I use cypress open.
But not work when I use cypress run.
TypeError: Cannot read property 'length' of undefined
at superMatcher (https://example.com/__cypress/runner/cypress_runner.js:86701:17)
at Sizzle.select (https://example.com/__cypress/runner/cypress_runner.js:86897:44)
at Function.Sizzle [as find] (https://example.com/__cypress/runner/cypress_runner.js:85065:9)
at jQuery.fn.init.find (https://example.com/__cypress/runner/cypress_runner.js:87096:11)
at find (https://example.com/__cypress/runner/cypress_runner.js:153939:31)
at getEl (https://example.com/__cypress/runner/cypress_runner.js:154030:18)
at getElements (https://example.com/__cypress/runner/cypress_runner.js:154058:17)
at Context.<anonymous> (https://example.com/__cypress/runner/cypress_runner.js:154082:14)
at Context.<anonymous> (https://example.com/__cypress/runner/cypress_runner.js:163288:21)
at https://example.com/__cypress/runner/cypress_runner.js:162724:15
at tryCatcher (https://example.com/__cypress/runner/cypress_runner.js:10161:23)
at Promise._settlePromiseFromHandler (https://example.com/__cypress/runner/cypress_runner.js:8096:31)
at Promise._settlePromise (https://example.com/__cypress/runner/cypress_runner.js:8153:18)
at Promise._settlePromiseCtx (https://example.com/__cypress/runner/cypress_runner.js:8190:10)
at _drainQueueStep (https://example.com/__cypress/runner/cypress_runner.js:4872:12)
Desired behavior:
What I do wrong?
Versions
Cypress: 4.8.0 Chrome Canary 85
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'length' of Undefined in JS
The "Cannot read property 'length' of undefined" error occurs when accessing the length property on an undefined value. To solve the error, make...
Read more >cypress-io/cypress - Gitter
Hi, running into an issue with a test I'm writing. When I visit the page, in the desktop app it redirects to a...
Read more >Cannot read properties of undefined (reading 'length')
### Current behavior Javascript error is thrown when using Cypress together wit…h Newrelic agent running on the browser. Error is: ``` Unable to ......
Read more >Cannot Read Property Length of Undefined in JavaScript
The TypeError: Cannot read property 'length' of undefined is one of the most common type errors in JavaScript. It occurs when the length ......
Read more >cypress - Cannot read properties of undefined (reading 'data')
To fix please change arrow functions () => { to non-arrow functions function() { . If using this you need to use function()...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The code for this is done in cypress-io/cypress#7746, but has yet to be released. We’ll update this issue and reference the changelog when it’s released.
Released in
4.9.0
.This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v4.9.0, please open a new issue.