Type/Press in input fields
I.type / I.press
I.press and I.type are exactly the same thing - we simply provided these two versions for whichever linguistic preference you have.
Press a key or a string of keys.
This will send keyboard inputs to the element in focus, or the page <body>
if no element is focus.
Usage
I.type(key)
Parameters
Parameter | Type | Remarks |
---|---|---|
Key | string, array of strings | Key(s) to Press |
Example(s)
Text Input
I.type("hello") // this will send "h" "e" "l" "l" "o"
Press a Key
I.press("?") // this will send "?"
Press a special key
// Send a special keys
I.press("Backspace") // This will press the "Backspace" key
I.press("Delete") // This will press the "Delete" key
I.pressEnter() // Convenience command are provided for frequently used keys
Press a Chord (send multiple keys simultaneously)
// Send a chord (press multiple keys at the same time)
I.press(["Shift", "a"])
I.press(["Alt", "A"])
I.press(["Control", "A"])
I.press(["Meta", "A"])
I.press(["Shift", "Control", "A"])
I.pressEnter
Press the Enter
key.
This is same as using the command I.press("Enter")
.
Usage
I.pressEnter()
I.pressUp
Press the ↑ key.
This is same as using the command I.press("ArrowUp")
.
Usage
I.pressUp()
I.pressDown
Press the ↓ key.
This is same as using the command I.press("ArrowDown")
.
Usage
I.pressDown()
I.pressLeft
Press the ← key.
This is same as using the command I.press("ArrowLeft")
.
Usage
I.pressLeft()
I.pressRight
Press the → key.
This is same as using the command I.press("ArrowRight")
.
Usage
I.pressRight()
I.pressTab
Press the → key.
This is same as using the command I.press("Tab")
.
Usage
I.pressTab()