Skip to content

Simulating Keyboard Commands

Francisco Ryan Tolmasky I edited this page Oct 18, 2016 · 1 revision

<type >text</type>

Animate the typing of a string into the given window or main page.

Attributes

  • window (optional) - Specify which window to type in, or null for the main page.
const { type } = require("demokit/keyboard");

<click selector = "input[type=text]"/>
<type>Hello There!</type>

<br />

Use <br/> for newlines when typing.

const { type, br } = require("demokit/keyboard");

<type>
    Hello There!<br/>
    How are you?
</type>

<paste >text</type>

Immediately inserts text, as if it had been pasted by the user.

Attributes

  • window (optional) - Specify which window to paste in, or null for the main page.
const { type, paste } = require("demokit/keyboard");

<type>var URL = "<paste>http://github.com/runkitdev/demokit</paste>"</type>

<key />

Types a single character code. Available character codes can be found here.

const { key } = require("demokit/keyboard");

<key code = "escape"/>
Clone this wiki locally