cypress: Cypress - TypeError: cannot read property 'KeyboardEvent' of undefined (Cypress version - 5.5.0)
While executing the code it is throwing TypeError for - cy.get('selector').type('pqr.com').
at Keyboard.fireSimulatedEvent ({{URL}}/__cypress/runner/cypress_runner.js:162534:29)
at Keyboard.simulatedKeydown ({{URL}}/__cypress/runner/cypress_runner.js:162679:59)
at Keyboard.typeSimulatedKey ({{URL}}/__cypress/runner/cypress_runner.js:162719:11)
at ({{URL}}/__cypress/runner/cypress_runner.js:162396:15)
From previous event:
at ({{URL}}/__cypress/runner/cypress_runner.js:162405:66)
From previous event:
at Keyboard.type ({{URL}}/__cypress/runner/cypress_runner.js:162404:61)
at type ({{URL}}/__cypress/runner/cypress_runner.js:153804:24)
at ({{URL}}/__cypress/runner/cypress_runner.js:153999:21)
From previous event:
at onReady ({{URL}}/__cypress/runner/cypress_runner.js:153975:15)
at runAllChecks ({{URL}}/__cypress/runner/cypress_runner.js:150154:15)
at retryActionability ({{URL}}/__cypress/runner/cypress_runner.js:150163:17)
From previous event:
at tryFn ({{URL}}/__cypress/runner/cypress_runner.js:165407:22)
at whenStable ({{URL}}/__cypress/runner/cypress_runner.js:165445:13)
at ({{URL}}/__cypress/runner/cypress_runner.js:164960:17)
From previous event:
at $Cy.retry ({{URL}}/__cypress/runner/cypress_runner.js:164940:39)
at retryActionability ({{URL}}/__cypress/runner/cypress_runner.js:150166:20)
at ({{URL}}/__cypress/runner/cypress_runner.js:150168:8)
From previous event:
at Object.verify ({{URL}}/__cypress/runner/cypress_runner.js:150095:22)
at handleFocused ({{URL}}/__cypress/runner/cypress_runner.js:153947:30)
at Context.type ({{URL}}/__cypress/runner/cypress_runner.js:154006:13)
at Context. ({{URL}}/__cypress/runner/cypress_runner.js:169891:22)
at ({{URL}}/__cypress/runner/cypress_runner.js:169315:16)
From previous event:
at runCommand ({{URL}}/__cypress/runner/cypress_runner.js:169294:9)
at next ({{URL}}/__cypress/runner/cypress_runner.js:169440:15)
at ({{URL}}/__cypress/runner/cypress_runner.js:169468:17)
From previous event:
at next ({{URL}}/__cypress/runner/cypress_runner.js:169440:35)
From previous event:
at Promise.catch.err.name ({{URL}}/__cypress/runner/cypress_runner.js:169481:38)
From previous event:
at run ({{URL}}/__cypress/runner/cypress_runner.js:169474:22)
at $Cy.cy. [as get] ({{URL}}/__cypress/runner/cypress_runner.js:169931:12)
at Context.runnable.fn ({{URL}}/__cypress/runner/cypress_runner.js:170155:22)
at callFn ({{URL}}/__cypress/runner/cypress_runner.js:104227:22)
at Test.../driver/node_modules/mocha/lib/runnable.js.Runnable.run ({{URL}}/__cypress/runner/cypress_runner.js:104214:8)
at ({{URL}}/__cypress/runner/cypress_runner.js:175754:29)
From previous event:
at Object.onRunnableRun ({{URL}}/__cypress/runner/cypress_runner.js:175742:18)
at $Cypress.action ({{URL}}/__cypress/runner/cypress_runner.js:166291:29)
at Test.Runnable.run ({{URL}}/__cypress/runner/cypress_runner.js:174128:14)
at Runner.../driver/node_modules/mocha/lib/runner.js.Runner.runTest ({{URL}}/__cypress/runner/cypress_runner.js:104886:11)
at ({{URL}}/__cypress/runner/cypress_runner.js:105012:13)
at next ({{URL}}/__cypress/runner/cypress_runner.js:104795:15)
at ({{URL}}/__cypress/runner/cypress_runner.js:104805:8)
at next ({{URL}}/__cypress/runner/cypress_runner.js:104707:15)
at ({{URL}}/__cypress/runner/cypress_runner.js:104773:6)
at timeslice ({{URL}}/__cypress/runner/cypress_runner.js:98699:28)
A web application which I am trying to automate contains the different text boxes. I have experienced that this issue is not related to the specific filed. But it is something relevant to the previous filed. Using Cypress (cy.get('selector').type('text')) I am able to type the proper value into one field and then when I try to enter the text into another text, mentioned issue is occurred. I have checked with changing the order of the text box and found that it is not specific to the particular field.
Also to note that, it is not throwing error if I try cy.get('selector').clear().
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 19 (4 by maintainers)
Commits related to this issue
- chore: Do not abuse reloadUntilCondition Part of request #40471 program management test is flacky How to test: make tests-e2e should pass. Why? Cypress has irregular issues typing into an input in ... — committed to Enalean/tuleap by Hyzual 2 years ago
- chore: Do not abuse reloadUntilCondition Part of request #40471 program management test is flacky How to test: make tests-e2e should pass. Why? Cypress has irregular issues typing into an input in ... — committed to Mictronics/tuleap by Hyzual 2 years ago
In case someone else is having this issue, hopefully this helps…
This forces Cypress to wait for the element to become visible. It also gets the input that is visible, as opposed to an old one that got detached, which happens in some JS frameworks that constantly re-render things.
In my case, after adding the
should, this intermittent issue reliably went away.Right now there doesn’t seem to be enough information to reproduce the problem on our end. We’ll have to close this issue until we can reproduce it. This does not mean that your issue is not happening - it just means that we do not have a path to move forward.
Please comment in this issue with a reproducible example and we will consider reopening the issue. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide.