or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

browser-management.mddevice-emulation.mdelement-handling.mdindex.mdinput-interaction.mdlocators-waiting.mdmedia-generation.mdnetwork-control.mdpage-interaction.mdperformance-debugging.md

input-interaction.mddocs/

0

# Input & Interaction

1

2

Keyboard, mouse, and touch input simulation for comprehensive user interaction automation.

3

4

## Capabilities

5

6

### Keyboard Class

7

8

Simulate keyboard input including typing, key presses, and modifier keys.

9

10

```typescript { .api }

11

/**

12

* Keyboard input simulation

13

*/

14

class Keyboard {

15

/** Type text with optional delay */

16

type(text: string, options?: {delay?: number}): Promise<void>;

17

18

/** Press and release key */

19

press(key: KeyInput, options?: PressOptions): Promise<void>;

20

21

/** Press key down (without releasing) */

22

down(key: KeyInput, options?: {text?: string}): Promise<void>;

23

24

/** Release key */

25

up(key: KeyInput): Promise<void>;

26

27

/** Send character directly */

28

sendCharacter(char: string): Promise<void>;

29

}

30

31

interface PressOptions {

32

delay?: number;

33

text?: string;

34

}

35

36

type KeyInput = "Enter" | "Tab" | "Escape" | "ArrowUp" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "Space" | "Backspace" | "Delete" | "Home" | "End" | "PageUp" | "PageDown" | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | "Digit0" | "Digit1" | "Digit2" | "Digit3" | "Digit4" | "Digit5" | "Digit6" | "Digit7" | "Digit8" | "Digit9" | "KeyA" | "KeyB" | "KeyC" | "KeyD" | "KeyE" | "KeyF" | "KeyG" | "KeyH" | "KeyI" | "KeyJ" | "KeyK" | "KeyL" | "KeyM" | "KeyN" | "KeyO" | "KeyP" | "KeyQ" | "KeyR" | "KeyS" | "KeyT" | "KeyU" | "KeyV" | "KeyW" | "KeyX" | "KeyY" | "KeyZ" | "ControlLeft" | "ControlRight" | "ShiftLeft" | "ShiftRight" | "AltLeft" | "AltRight" | "MetaLeft" | "MetaRight";

37

```

38

39

**Usage Examples:**

40

41

```typescript

42

// Basic typing

43

await page.keyboard.type("Hello World", { delay: 100 });

44

45

// Key combinations

46

await page.keyboard.down("ControlLeft");

47

await page.keyboard.press("KeyA"); // Ctrl+A

48

await page.keyboard.up("ControlLeft");

49

50

// Navigation

51

await page.keyboard.press("Tab");

52

await page.keyboard.press("Enter");

53

```

54

55

### Mouse Class

56

57

Simulate mouse interactions including clicks, movements, and drag operations.

58

59

```typescript { .api }

60

/**

61

* Mouse input simulation

62

*/

63

class Mouse {

64

/** Reset mouse state */

65

reset(): Promise<void>;

66

67

/** Move mouse to coordinates */

68

move(x: number, y: number, options?: {steps?: number}): Promise<void>;

69

70

/** Click at coordinates */

71

click(x: number, y: number, options?: MouseClickOptions): Promise<void>;

72

73

/** Press mouse button down */

74

down(options?: MouseOptions): Promise<void>;

75

76

/** Release mouse button */

77

up(options?: MouseOptions): Promise<void>;

78

79

/** Scroll mouse wheel */

80

wheel(options?: MouseWheelOptions): Promise<void>;

81

82

/** Drag from start to target */

83

dragAndDrop(start: Point, target: Point, options?: {delay?: number}): Promise<void>;

84

}

85

86

interface MouseClickOptions {

87

button?: "left" | "right" | "middle";

88

clickCount?: number;

89

delay?: number;

90

}

91

92

interface MouseOptions {

93

button?: "left" | "right" | "middle";

94

clickCount?: number;

95

}

96

97

interface MouseWheelOptions {

98

deltaX?: number;

99

deltaY?: number;

100

}

101

102

interface Point {

103

x: number;

104

y: number;

105

}

106

```

107

108

**Usage Examples:**

109

110

```typescript

111

// Click at specific coordinates

112

await page.mouse.click(100, 200);

113

114

// Double click

115

await page.mouse.click(100, 200, { clickCount: 2 });

116

117

// Drag and drop

118

await page.mouse.dragAndDrop(

119

{ x: 100, y: 100 },

120

{ x: 200, y: 200 },

121

{ delay: 1000 }

122

);

123

124

// Scroll

125

await page.mouse.wheel({ deltaY: -100 }); // Scroll up

126

```

127

128

### Touchscreen Class

129

130

Simulate touch interactions for mobile and tablet interfaces.

131

132

```typescript { .api }

133

/**

134

* Touchscreen input simulation

135

*/

136

class Touchscreen {

137

/** Start touch at coordinates */

138

touchStart(x: number, y: number): Promise<TouchHandle>;

139

140

/** Move active touch */

141

touchMove(x: number, y: number): Promise<void>;

142

143

/** End active touch */

144

touchEnd(): Promise<void>;

145

146

/** Single tap at coordinates */

147

tap(x: number, y: number): Promise<void>;

148

}

149

150

interface TouchHandle {

151

move(point: Point): Promise<void>;

152

end(): Promise<void>;

153

}

154

```

155

156

**Usage Examples:**

157

158

```typescript

159

// Simple tap

160

await page.touchscreen.tap(100, 100);

161

162

// Swipe gesture

163

const touch = await page.touchscreen.touchStart(100, 100);

164

await touch.move({ x: 200, y: 100 }); // Swipe right

165

await touch.end();

166

```