or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

automation-patterns.mdcontrol-management.mdcontrol-types.mdindex.mdinput-simulation.mdlogging-debugging.mdscreen-capture.mdwindows-api.md

control-types.mddocs/

0

# Control Types

1

2

Comprehensive set of 40+ control classes representing all Windows UI element types. Each control class inherits from the base `Control` class and provides specialized functionality for specific UI elements like buttons, text fields, lists, and complex data grids.

3

4

## Base Control Class

5

6

### Control

7

8

The base class that all specific control types inherit from, providing common functionality for UI element interaction and property access.

9

10

```python { .api }

11

class Control:

12

"""Base class for all UI controls."""

13

14

# Core Properties

15

Name: str # Display name of the control

16

ControlType: int # Windows control type identifier

17

ClassName: str # Windows class name

18

AutomationId: str # Automation identifier

19

ProcessId: int # Process ID owning the control

20

IsEnabled: bool # Whether control accepts user input

21

HasKeyboardFocus: bool # Whether control currently has focus

22

IsKeyboardFocusable: bool # Whether control can receive focus

23

IsOffScreen: bool # Whether control is visible on screen

24

BoundingRectangle: Rect # Control bounds in screen coordinates

25

Handle: int # Windows handle (HWND) if available

26

27

def Click(self) -> None:

28

"""Click the control at its center point."""

29

30

def RightClick(self) -> None:

31

"""Right-click the control at its center point."""

32

33

def MiddleClick(self) -> None:

34

"""Middle-click the control at its center point."""

35

36

def DoubleClick(self) -> None:

37

"""Double-click the control at its center point."""

38

39

def MoveCursor(self) -> None:

40

"""Move the mouse cursor to the control's center."""

41

42

def SetFocus(self) -> None:

43

"""Set keyboard focus to this control."""

44

45

def SendKey(self, key: int, modifiers: int = 0) -> None:

46

"""

47

Send a key to the control.

48

49

Args:

50

key: Virtual key code

51

modifiers: Modifier keys (ALT, CTRL, SHIFT, WIN)

52

"""

53

54

def SendKeys(self, keys: str) -> None:

55

"""

56

Send a sequence of keys to the control.

57

58

Args:

59

keys: String representing keys to send

60

"""

61

62

def WheelUp(self, times: int = 1) -> None:

63

"""Scroll mouse wheel up."""

64

65

def WheelDown(self, times: int = 1) -> None:

66

"""Scroll mouse wheel down."""

67

68

def GetChildren(self) -> list[Control]:

69

"""Get all direct child controls."""

70

71

def GetParentControl(self) -> Control:

72

"""Get the parent control."""

73

74

def GetTopLevelControl(self) -> Control:

75

"""Get the top-level window containing this control."""

76

77

def GetNextSiblingControl(self) -> Control:

78

"""Get the next sibling control."""

79

80

def GetPreviousSiblingControl(self) -> Control:

81

"""Get the previous sibling control."""

82

83

def Exists(self, timeout: float = 0) -> bool:

84

"""Check if the control exists."""

85

86

def WaitForExist(self, timeout: float = 15) -> bool:

87

"""Wait for the control to exist."""

88

89

def WaitForDisappear(self, timeout: float = 15) -> bool:

90

"""Wait for the control to disappear."""

91

92

def Show(self) -> None:

93

"""Show the control/window."""

94

95

def Hide(self) -> None:

96

"""Hide the control/window."""

97

98

def CaptureToImage(self, filename: str) -> None:

99

"""Capture the control to an image file."""

100

101

def GetProperties(self) -> dict:

102

"""Get all control properties as a dictionary."""

103

```

104

105

## Window and Container Controls

106

107

Controls that serve as containers for other UI elements or represent windows.

108

109

```python { .api }

110

class WindowControl(Control):

111

"""Represents a top-level window."""

112

113

class PaneControl(Control):

114

"""Represents a pane container control."""

115

116

class GroupControl(Control):

117

"""Represents a group box control."""

118

119

class DocumentControl(Control):

120

"""Represents a document area control."""

121

122

class TitleBarControl(Control):

123

"""Represents a window title bar."""

124

125

class CustomControl(Control):

126

"""Represents a custom or unknown control type."""

127

```

128

129

## Input Controls

130

131

Controls that accept user input through clicking, typing, or selection.

132

133

```python { .api }

134

class ButtonControl(Control):

135

"""Represents a clickable button control."""

136

137

class EditControl(Control):

138

"""Represents a text input control."""

139

140

class CheckBoxControl(Control):

141

"""Represents a checkbox control."""

142

143

class RadioButtonControl(Control):

144

"""Represents a radio button control."""

145

146

class ComboBoxControl(Control):

147

"""Represents a combo box (dropdown) control."""

148

149

class SliderControl(Control):

150

"""Represents a slider control."""

151

152

class SpinnerControl(Control):

153

"""Represents a spinner (up/down) control."""

154

155

class SplitButtonControl(Control):

156

"""Represents a split button control."""

157

```

158

159

## Display Controls

160

161

Controls that display information or provide visual feedback to users.

162

163

```python { .api }

164

class TextControl(Control):

165

"""Represents a text display control."""

166

167

class ImageControl(Control):

168

"""Represents an image display control."""

169

170

class ProgressBarControl(Control):

171

"""Represents a progress bar control."""

172

173

class StatusBarControl(Control):

174

"""Represents a status bar control."""

175

176

class ToolTipControl(Control):

177

"""Represents a tooltip control."""

178

179

class SeparatorControl(Control):

180

"""Represents a separator line control."""

181

182

class ThumbControl(Control):

183

"""Represents a thumb control (e.g., slider thumb)."""

184

```

185

186

## List and Tree Controls

187

188

Controls for displaying and selecting from collections of items.

189

190

```python { .api }

191

class ListControl(Control):

192

"""Represents a list control."""

193

194

class ListItemControl(Control):

195

"""Represents an item within a list control."""

196

197

class TreeControl(Control):

198

"""Represents a tree view control."""

199

200

class TreeItemControl(Control):

201

"""Represents an item within a tree control."""

202

203

class DataGridControl(Control):

204

"""Represents a data grid control."""

205

206

class DataItemControl(Control):

207

"""Represents an item within a data grid."""

208

209

class TableControl(Control):

210

"""Represents a table control."""

211

```

212

213

## Menu Controls

214

215

Controls for application menus and menu items.

216

217

```python { .api }

218

class MenuControl(Control):

219

"""Represents a menu control."""

220

221

class MenuBarControl(Control):

222

"""Represents a menu bar control."""

223

224

class MenuItemControl(Control):

225

"""Represents a menu item control."""

226

```

227

228

## Tab Controls

229

230

Controls for tabbed interfaces.

231

232

```python { .api }

233

class TabControl(Control):

234

"""Represents a tab container control."""

235

236

class TabItemControl(Control):

237

"""Represents an individual tab within a tab control."""

238

```

239

240

## Toolbar Controls

241

242

Controls for application toolbars.

243

244

```python { .api }

245

class ToolBarControl(Control):

246

"""Represents a toolbar control."""

247

```

248

249

## Scrolling Controls

250

251

Controls that provide scrolling functionality.

252

253

```python { .api }

254

class ScrollBarControl(Control):

255

"""Represents a scroll bar control."""

256

```

257

258

## Calendar Controls

259

260

Controls for date and time selection.

261

262

```python { .api }

263

class CalendarControl(Control):

264

"""Represents a calendar control."""

265

```

266

267

## Header Controls

268

269

Controls for column headers and header items.

270

271

```python { .api }

272

class HeaderControl(Control):

273

"""Represents a header control."""

274

275

class HeaderItemControl(Control):

276

"""Represents an item within a header control."""

277

```

278

279

## Hyperlink Controls

280

281

Controls for clickable hyperlinks.

282

283

```python { .api }

284

class HyperlinkControl(Control):

285

"""Represents a hyperlink control."""

286

```

287

288

## Modern UI Controls

289

290

Controls specific to Windows 8+ Modern UI applications.

291

292

```python { .api }

293

class AppBarControl(Control):

294

"""Represents an app bar control (Windows 8+ Metro)."""

295

296

class SemanticZoomControl(Control):

297

"""Represents a semantic zoom control (Windows 8+ Metro)."""

298

```

299

300

## Control Type Constants

301

302

```python { .api }

303

class ControlType:

304

"""Constants for Windows UI Automation control types."""

305

AppBarControl: int

306

ButtonControl: int

307

CalendarControl: int

308

CheckBoxControl: int

309

ComboBoxControl: int

310

CustomControl: int

311

DataGridControl: int

312

DataItemControl: int

313

DocumentControl: int

314

EditControl: int

315

GroupControl: int

316

HeaderControl: int

317

HeaderItemControl: int

318

HyperlinkControl: int

319

ImageControl: int

320

ListControl: int

321

ListItemControl: int

322

MenuBarControl: int

323

MenuControl: int

324

MenuItemControl: int

325

PaneControl: int

326

ProgressBarControl: int

327

RadioButtonControl: int

328

ScrollBarControl: int

329

SemanticZoomControl: int

330

SeparatorControl: int

331

SliderControl: int

332

SpinnerControl: int

333

SplitButtonControl: int

334

StatusBarControl: int

335

TabControl: int

336

TabItemControl: int

337

TableControl: int

338

TextControl: int

339

ThumbControl: int

340

TitleBarControl: int

341

ToolBarControl: int

342

ToolTipControl: int

343

TreeControl: int

344

TreeItemControl: int

345

WindowControl: int

346

```

347

348

## Usage Examples

349

350

### Basic Control Usage

351

352

```python

353

import uiautomation

354

355

# Find and click a button

356

ok_button = uiautomation.ButtonControl(Name='OK')

357

if ok_button.Exists():

358

ok_button.Click()

359

360

# Type into an edit control

361

username_field = uiautomation.EditControl(AutomationId='txtUsername')

362

username_field.SetFocus()

363

username_field.SendKeys('myusername')

364

365

# Check a checkbox

366

agree_checkbox = uiautomation.CheckBoxControl(Name='I agree to the terms')

367

agree_checkbox.Click()

368

```

369

370

### Working with Lists and Trees

371

372

```python

373

# Select an item from a list

374

file_list = uiautomation.ListControl(Name='Files')

375

file_item = file_list.ListItemControl(Name='document.txt')

376

file_item.Click()

377

378

# Expand a tree node

379

tree = uiautomation.TreeControl(Name='Directory Tree')

380

folder_node = tree.TreeItemControl(Name='My Documents')

381

folder_node.DoubleClick() # Expand the folder

382

```

383

384

### Menu Navigation

385

386

```python

387

# Access application menu

388

menu_bar = uiautomation.MenuBarControl()

389

file_menu = menu_bar.MenuItemControl(Name='File')

390

file_menu.Click()

391

392

# Click a menu item

393

save_item = uiautomation.MenuItemControl(Name='Save')

394

save_item.Click()

395

```

396

397

### Tab Navigation

398

399

```python

400

# Switch to a different tab

401

tab_control = uiautomation.TabControl()

402

settings_tab = tab_control.TabItemControl(Name='Settings')

403

settings_tab.Click()

404

```

405

406

### Complex Control Hierarchies

407

408

```python

409

# Navigate through nested controls

410

main_window = uiautomation.WindowControl(Name='Application')

411

settings_pane = main_window.PaneControl(AutomationId='settingsPane')

412

user_group = settings_pane.GroupControl(Name='User Settings')

413

email_field = user_group.EditControl(Name='Email Address')

414

email_field.SendKeys('user@example.com')

415

```