Pretty basic but how can I press {esc} key over the page? #17557
Unanswered
MatiDiez
asked this question in
Questions and Help
Replies: 1 comment
-
maybe too late but this worked for me: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone, I'm testing a page. One of my steps enebles/disables a pop up in the page.
Some times it takes a bit longer to disable the popup on the backend, so on my subsequent test, I randomly get or don't get the pop up.
So, the easiest straight forward solution for me, is to press Escape key. If the pop up is present it will be closed, if it is not, nothing happens. So my question is:
How to I simulate pressing the Escape key?
I tried
cy.type('{esc}')
which obviously doesn't work because it has to be chained to a DOM element. I also triedcy.get('body').trigger('keydown', { keyCode: 27})
but it didn't work. Any suggestions?Beta Was this translation helpful? Give feedback.
All reactions