Skip to content
CodeKruPro

Keyboard Press

53/70

Keyboard Press

page.keyboard.press(key) simulates pressing a keyboard key. On the Keyboard Actions page, the #output div shows three bold values: the keys held down, the event type, and the previously typed keys. The last <strong> holds the typed keys.

Task:

  1. Navigate to https://testkru.com/Interactions/KeyboardActions
  2. Click on the page body to ensure focus
  3. Press the "a" key
  4. Print the text of the last <strong> inside #output

Expected output:

Typed keys: a