question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'length' of undefined when run test by cypress run

See original GitHub issue

Current 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.

Screenshot 2020-06-11 at 10 53 53

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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cypress-bot[bot]commented, Jun 18, 2020

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.

0reactions
cypress-bot[bot]commented, Jun 23, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found