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.

Send key F3 without input

See original GitHub issue

I am newbie on cypress.

I need write a test with F3 send key to page.

I wrote this (114 = charcode key for F3):

cy.get('body').type('{114}')  // (not ok) 
cy.get('body').type('{{114}') // (not ok)

Pease help

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

24reactions
jennifer-shehanecommented, Jun 4, 2018

The only special characters built in to Cypress are listed in the docs here. There is not a special character for {114}.

You should be able to trigger the keydown event with the character code needed for F3 using .trigger() like this:

cy.get('body').trigger('keydown', { keyCode: 114, which: 114 })

Let me know if this works.

15reactions
peetjvvcommented, Feb 8, 2019

I recently ran into a similar issue and came across this thread. In my case I had to trigger a Backspace. Unfortunately @jennifer-shehane 's suggestion didn’t work. I later learned that keyCode is deprecated in KeyboardEvent, but using key worked for me.

Here is my code:

cy.get('body').trigger("keydown", { key: "Backspace" });

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use Excel SendKeys Method in Macros - Contextures
The SendKeys method simulates keystrokes that you would manually input in the active window. Use with caution, because it can have unexpected ...
Read more >
SendKeys statement (VBA) - Microsoft Learn
It uses the SendKeys statement to send keystrokes to add some numbers and then quit the Calculator. (To see the example, paste it...
Read more >
Sending function keys (F1-F12) over SSH
Terminals only understand characters, not keys. ... Enter is Ctrl+M , Esc is Ctrl+[ ), function keys send escape sequences, beginning with ...
Read more >
Send Key – Function 3 - Rocket Software
Meaning Mnemonic 3270 5250 @ @@ X Alt @A X Alternate cursor @$ X X
Read more >
Function Send - AutoIt
Due to the send AutoIt implementation the CAPS LOCKed character will be sent as a Shifted character so it will not work. Certain...
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