appium-novawindows2-driver 0.1.12 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +400 -427
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,557 +1,530 @@
|
|
|
1
|
-
|
|
1
|
+
NovaWindows2 Driver
|
|
2
2
|
===================
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
NovaWindows2 Driver is a custom Appium driver designed to tackle the limitations of existing Windows automation solutions like WinAppDriver. It supports testing Universal Windows Platform (UWP), Windows Forms (WinForms), Windows Presentation Foundation (WPF), and Classic Windows (Win32) apps on Windows 10 and later.
|
|
5
|
+
|
|
6
|
+
Built to improve performance and reliability for traditional desktop applications, it offers:
|
|
7
|
+
- **Faster XPath locator performance** — Reduces element lookup times, even in complex UIs.
|
|
8
|
+
- **RawView element support** — Access elements typically hidden from the default ControlView/ContentView.
|
|
9
|
+
- **Enhanced text input handling** — Fast text entry with support for various keyboard layouts.
|
|
10
|
+
- **Platform-specific commands** — Supports direct window manipulation, advanced UI interactions, and more.
|
|
11
|
+
- **Seamless Setup** — Designed to work without Developer Mode or additional software.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 📑 Table of Contents
|
|
16
|
+
- [Getting Started](#-getting-started)
|
|
17
|
+
- [Configuration](#-configuration)
|
|
18
|
+
- [Example Usage](#-example-usage)
|
|
19
|
+
- [Key Features](#-key-features)
|
|
20
|
+
- [Element Location](#element-location)
|
|
21
|
+
- [Attribute Retrieval](#attribute-retrieval)
|
|
22
|
+
- [PowerShell Execution](#powershell-execution)
|
|
23
|
+
- [Platform-Specific Extensions](#-platform-specific-extensions)
|
|
24
|
+
- [Mouse & Pointer](#mouse--pointer)
|
|
25
|
+
- [Keyboard](#keyboard)
|
|
26
|
+
- [Element Operations](#element-operations)
|
|
27
|
+
- [Selection Management](#selection-management)
|
|
28
|
+
- [Window Management](#window-management)
|
|
29
|
+
- [System & State](#system--state)
|
|
30
|
+
- [Development](#-development)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🚀 Getting Started
|
|
35
|
+
|
|
36
|
+
### Installation
|
|
37
|
+
The driver is built for Appium 3. To install it, run:
|
|
38
|
+
```bash
|
|
39
|
+
appium driver install --source=npm appium-novawindows2-driver
|
|
40
|
+
```
|
|
5
41
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Platform-specific commands — Supports direct window manipulation, advanced UI interactions, and more.
|
|
10
|
-
It’s designed to handle real-world scenarios where traditional drivers fall short — from tricky dropdowns to missing elements and unreliable clicks — making it an ideal choice for automating legacy Windows apps.
|
|
42
|
+
### Prerequisites
|
|
43
|
+
- **Host OS**: Windows 10 or later.
|
|
44
|
+
- No Developer Mode or extra dependencies required.
|
|
11
45
|
|
|
12
|
-
|
|
13
|
-
>
|
|
14
|
-
> This driver is built for Appium 2/3 and is not compatible with Appium 1. To install
|
|
15
|
-
> the driver, simply run:
|
|
16
|
-
> `appium driver install --source=npm appium-novawindows-driver`
|
|
46
|
+
---
|
|
17
47
|
|
|
48
|
+
## ⚙️ Configuration
|
|
18
49
|
|
|
19
|
-
|
|
50
|
+
NovaWindows2 Driver supports the following capabilities:
|
|
20
51
|
|
|
21
|
-
|
|
52
|
+
| Capability Name | Description | Default | Example |
|
|
53
|
+
| :--- | :--- | :--- | :--- |
|
|
54
|
+
| `platformName` | Must be set to `Windows` (case-insensitive). | (Required) | `Windows` |
|
|
55
|
+
| `automationName` | Must be set to `NovaWindows2` (case-insensitive). | (Required) | `NovaWindows2` |
|
|
56
|
+
| `smoothPointerMove` | CSS-like easing function (including valid Bezier curve). This controls the smooth movement of the mouse for `delayBeforeClick` ms. | (None) | `ease-in`, `cubic-bezier(0.42, 0, 0.58, 1)` |
|
|
57
|
+
| `delayBeforeClick` | Time in milliseconds before a click is performed. | `0` | `500` |
|
|
58
|
+
| `delayAfterClick` | Time in milliseconds after a click is performed. | `0` | `500` |
|
|
59
|
+
| `appTopLevelWindow` | The handle of an existing application top-level window to attach to. It can be a number or string (not necessarily hexadecimal). | (None) | `12345`, `0x12345` |
|
|
60
|
+
| `shouldCloseApp` | Whether to close the window of the application in test after the session finishes. | `true` | `false` |
|
|
61
|
+
| `appArguments` | Optional string of arguments to pass to the app on launch. | (None) | `--debug` |
|
|
62
|
+
| `appWorkingDir` | Optional working directory path for the application. | (None) | `C:\Temp` |
|
|
63
|
+
| `prerun` | An object containing either `script` or `command` key. The value of each key must be a valid PowerShell script or command to be executed prior to the WinAppDriver session startup. See [Power Shell commands execution](#powershell-execution) for more details. | (None) | `{script: 'Get-Process outlook -ErrorAction SilentlyContinue'}` |
|
|
64
|
+
| `postrun` | An object containing either `script` or `command` key. The value of each key must be a valid PowerShell script or command to be executed after WinAppDriver session is stopped. See [Power Shell commands execution](#powershell-execution) for more details. | (None) | `{command: '...'}` |
|
|
65
|
+
| `isolatedScriptExecution` | Whether PowerShell scripts are executed in an isolated session. | `false` | `true` |
|
|
66
|
+
| `appWaitForLaunchRetries` | Number of retries when waiting for the app to launch. | `20` | `5` |
|
|
67
|
+
| `appWaitForLaunchRetryIntervalMs` | Interval (ms) between app launch check retries. | `500` | `500` |
|
|
68
|
+
| `powerShellCommandTimeout` | Timeout (ms) for PowerShell script execution. | `60000` | `30000` |
|
|
69
|
+
| `convertAbsoluteXPathToRelativeFromElement` | Convert absolute XPath to relative when searching from an element. | `true` | `true` |
|
|
70
|
+
| `includeContextElementInSearch` | Include the context element itself in the search. | `true` | `true` |
|
|
71
|
+
| `releaseModifierKeys` | Whether to release modifier keys after `sendKeys`. | `true` | `true` |
|
|
22
72
|
|
|
23
|
-
|
|
73
|
+
---
|
|
24
74
|
|
|
25
|
-
|
|
26
|
-
>
|
|
27
|
-
> The driver currently uses a PowerShell session as a back-end, and
|
|
28
|
-
> should not require Developer Mode to be on, or any other software.
|
|
29
|
-
> There's a plan to update to a better, .NET-based backend for improved
|
|
30
|
-
> realiability and better code and error management, as well as supporting
|
|
31
|
-
> more features, that are currently not possible using PowerShell alone.
|
|
32
|
-
> It is unlikely for the prerequisites to change, as this is one of the
|
|
33
|
-
> main goals of NovaWindows driver – seamless setup on any PC.
|
|
34
|
-
|
|
35
|
-
NovaWindows Driver supports the following capabilities:
|
|
36
|
-
|
|
37
|
-
Capability Name | Description
|
|
38
|
-
--- | ---
|
|
39
|
-
platformName | Must be set to `Windows` (case-insensitive).
|
|
40
|
-
automationName | Must be set to `NovaWindows` (case-insensitive).
|
|
41
|
-
smoothPointerMove | CSS-like easing function (including valid Bezier curve). This controls the smooth movement of the mouse for `delayBeforeClick` ms. Example: `ease-in`, `cubic-bezier(0.42, 0, 0.58, 1)`.
|
|
42
|
-
delayBeforeClick | Time in milliseconds before a click is performed.
|
|
43
|
-
delayAfterClick | Time in milliseconds after a click is performed.
|
|
44
|
-
appTopLevelWindow | The handle of an existing application top-level window to attach to. It can be a number or string (not necessarily hexadecimal). Example: `12345`, `0x12345`.
|
|
45
|
-
shouldCloseApp | Whether to close the window of the application in test after the session finishes. Default is `true`.
|
|
46
|
-
appArguments | Optional string of arguments to pass to the app on launch.
|
|
47
|
-
appWorkingDir | Optional working directory path for the application.
|
|
48
|
-
prerun | An object containing either `script` or `command` key. The value of each key must be a valid PowerShell script or command to be executed prior to the WinAppDriver session startup. See [Power Shell commands execution](#power-shell-commands-execution) for more details. Example: `{script: 'Get-Process outlook -ErrorAction SilentlyContinue'}`
|
|
49
|
-
postrun | An object containing either `script` or `command` key. The value of each key must be a valid PowerShell script or command to be executed after WinAppDriver session is stopped. See [Power Shell commands execution](#power-shell-commands-execution) for more details.
|
|
50
|
-
isolatedScriptExecution | Whether PowerShell scripts are executed in an isolated session. Default is `false`.
|
|
51
|
-
|
|
52
|
-
Please note that more capabilities will be added as the development of this driver progresses. Since it is still in its early stages, some features may be missing or subject to change. If you need a specific capability or encounter any issues, please feel free to open an issue.
|
|
53
|
-
|
|
54
|
-
## Example
|
|
75
|
+
## 💡 Example Usage
|
|
55
76
|
|
|
56
|
-
|
|
57
|
-
# Python3 + PyTest
|
|
58
|
-
import pytest
|
|
77
|
+
Check out the [examples/refactor](examples/refactor) directory for comprehensive examples.
|
|
59
78
|
|
|
79
|
+
### Python (Appium-Python-Client)
|
|
80
|
+
```python
|
|
60
81
|
from appium import webdriver
|
|
61
82
|
from appium.options.windows import WindowsOptions
|
|
62
83
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
# https://www.securitylearningacademy.com/mod/book/view.php?id=13829&chapterid=678
|
|
67
|
-
uwp_options.app = 'Microsoft.WindowsCalculator_8wekyb3d8bbwe!App'
|
|
68
|
-
uwp_options.automation_name = 'NovaWindows'
|
|
69
|
-
|
|
70
|
-
classic_options = WindowsOptions()
|
|
71
|
-
classic_options.app = 'C:\\Windows\\System32\\notepad.exe'
|
|
72
|
-
classic_options.automation_name = 'NovaWindows'
|
|
73
|
-
|
|
74
|
-
use_existing_app_options = WindowsOptions()
|
|
75
|
-
# Active window handles could be retrieved from any compatible UI inspector app:
|
|
76
|
-
# https://docs.microsoft.com/en-us/windows/win32/winauto/inspect-objects
|
|
77
|
-
# or https://accessibilityinsights.io/.
|
|
78
|
-
# Also, it is possible to use the corresponding WinApi calls for this purpose:
|
|
79
|
-
# https://referencesource.microsoft.com/#System/services/monitoring/system/diagnosticts/ProcessManager.cs,db7ac68b7cb40db1
|
|
80
|
-
#
|
|
81
|
-
# This capability could be used to create a workaround for UWP apps startup:
|
|
82
|
-
# https://github.com/microsoft/WinAppDriver/blob/master/Samples/C%23/StickyNotesTest/StickyNotesSession.cs
|
|
83
|
-
use_existing_app_options.app_top_level_window = hex(12345)
|
|
84
|
-
use_existing_app_options.automation_name = 'NovaWindows'
|
|
85
|
-
|
|
86
|
-
return [uwp_options, classic_options, use_existing_app_options]
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
@pytest.fixture(params=generate_options())
|
|
90
|
-
def driver(request):
|
|
91
|
-
drv = webdriver.Remote('http://127.0.0.1:4723', options=request.param)
|
|
92
|
-
yield drv
|
|
93
|
-
drv.quit()
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def test_app_source_could_be_retrieved(driver):
|
|
97
|
-
assert len(driver.page_source) > 0
|
|
98
|
-
```
|
|
99
|
-
|
|
84
|
+
options = WindowsOptions()
|
|
85
|
+
options.app = 'C:\\Windows\\System32\\notepad.exe'
|
|
86
|
+
options.automation_name = 'NovaWindows2'
|
|
100
87
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
run custom Power Shell scriptsfrom your client code. This feature is potentially insecure
|
|
105
|
-
and thus needs to beexplicitly enabled when executing the server by providing `power_shell`
|
|
106
|
-
key to the listof enabled insecure features. Refer to [Appium Security document](https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/security.md) for more details.
|
|
107
|
-
It is possible to ether execute a single Power Shell command or a whole script
|
|
108
|
-
and get its stdout in response. If the script execution returns non-zero exit code then an exception
|
|
109
|
-
is going to be thrown. The exception message will contain the actual stderr. Unlike, Appium Windows Driver,
|
|
110
|
-
there is no difference if you paste the script with `command` or `script` argument. For ease of use, you can pass the script as a string when executing a PowerShell command directly via the driver. Note: This shorthand does not work when using the prerun or postrun capabilities, which require full object syntax.
|
|
111
|
-
Here's an example code of how to control the Notepad process:
|
|
112
|
-
|
|
113
|
-
```java
|
|
114
|
-
// java
|
|
115
|
-
String psScript =
|
|
116
|
-
"$sig = '[DllImport(\"user32.dll\")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'\n" +
|
|
117
|
-
"Add-Type -MemberDefinition $sig -name NativeMethods -namespace Win32\n" +
|
|
118
|
-
"Start-Process Notepad\n" +
|
|
119
|
-
"$hwnd = @(Get-Process Notepad)[0].MainWindowHandle\n" +
|
|
120
|
-
"[Win32.NativeMethods]::ShowWindowAsync($hwnd, 2)\n" +
|
|
121
|
-
"[Win32.NativeMethods]::ShowWindowAsync($hwnd, 4)\n" +
|
|
122
|
-
"Stop-Process -Name Notepad";
|
|
123
|
-
driver.executeScript("powerShell", psScript);
|
|
88
|
+
driver = webdriver.Remote('http://127.0.0.1:4723', options=options)
|
|
89
|
+
# ... tests ...
|
|
90
|
+
driver.quit()
|
|
124
91
|
```
|
|
125
92
|
|
|
126
|
-
|
|
93
|
+
---
|
|
127
94
|
|
|
128
|
-
|
|
129
|
-
# python
|
|
130
|
-
cmd = 'Get-Process outlook -ErrorAction SilentlyContinue'
|
|
131
|
-
proc_info = driver.execute_script('powerShell', cmd)
|
|
132
|
-
if proc_info:
|
|
133
|
-
print('Outlook is running')
|
|
134
|
-
else:
|
|
135
|
-
print('Outlook is not running')
|
|
136
|
-
```
|
|
95
|
+
## ✨ Key Features
|
|
137
96
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
> NovaWindows Driver runs on a single PowerShell session,
|
|
141
|
-
> therefore you may share variables between executed PowerShell
|
|
142
|
-
> scripts. Unless the PowerShell session exits or crashes for some
|
|
143
|
-
> reason, you should be able to reuse the variables that you create.
|
|
97
|
+
### Element Location
|
|
98
|
+
Appium Windows Driver supports the same location strategies [the WinAppDriver supports](https://github.com/microsoft/WinAppDriver/blob/master/Docs/AuthoringTestScripts.md#supported-locators-to-find-ui-elements), but also includes Windows UIAutomation conditions:
|
|
144
99
|
|
|
100
|
+
| Name | Description | Example |
|
|
101
|
+
| :--- | :--- | :--- |
|
|
102
|
+
| `accessibility id` | This strategy is `AutomationId` attribute in inspect.exe | `CalculatorResults` |
|
|
103
|
+
| `class name` | This strategy is `ClassName` attribute in inspect.exe | `TextBlock` |
|
|
104
|
+
| `id` | This strategy is `RuntimeId` (decimal) attribute in inspect.exe | `42.333896.3.1` |
|
|
105
|
+
| `name` | This strategy is `Name` attribute in inspect.exe | `Calculator` |
|
|
106
|
+
| `tag name` | This strategy is `LocalizedControlType` (upper camel case) attribute in inspect.exe | `Text` |
|
|
107
|
+
| `xpath` | Custom XPath 1.0 queries on any attribute exposed by inspect.exe. | `(//Button)[2]` |
|
|
108
|
+
| `windows uiautomation` | UIAutomation conditions (C# or PowerShell syntax). | `new PropertyCondition(...)` |
|
|
145
109
|
|
|
146
|
-
|
|
110
|
+
### Attribute Retrieval
|
|
111
|
+
Retrieve comprehensive details about UI elements using standard or bulk methods.
|
|
147
112
|
|
|
148
|
-
|
|
113
|
+
- **Bulk Retrieval**: Use the `"all"` keyword to get 80+ properties in a single JSON object.
|
|
114
|
+
- **Dotted Names**: Access pattern-specific properties directly (e.g., `Window.CanMaximize`, `LegacyIAccessible.Name`).
|
|
149
115
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
id | This strategy is RuntimeId (decimal) attribute in inspect.exe | 42.333896.3.1
|
|
155
|
-
name | This strategy is Name attribute in inspect.exe | Calculator
|
|
156
|
-
tag name | This strategy is LocalizedControlType (upper camel case) attribute in inspect.exe since Appium Windows Driver 2.1.1 | Text
|
|
157
|
-
xpath | This strategy allows to create custom XPath queries on any attribute exposed by inspect.exe. Only XPath 1.0 is supported | (//Button)[2]
|
|
158
|
-
windows uiautomation | This strategy allows to create custom Windows UIAutomation conditions on any attribute exposed by inspect.exe. Both C# and PowerShell syntax is supported | new PropertyCondition(AutomationElement.HelpTextProperty, "Info")
|
|
116
|
+
```js
|
|
117
|
+
// getAttributes returns all properties as a JSON string
|
|
118
|
+
const allAttributes = await element.getAttribute("all");
|
|
119
|
+
```
|
|
159
120
|
|
|
160
|
-
|
|
121
|
+
### PowerShell Execution
|
|
122
|
+
Execute internal PowerShell scripts or commands directly from your test. This requires the `power_shell` insecure feature to be enabled on the Appium server.
|
|
161
123
|
|
|
162
|
-
|
|
124
|
+
It is possible to execute a single PowerShell command or a whole script. Note that `powerShell` is case-insensitive.
|
|
163
125
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
> more intuitively by just the element as a second argument and the value
|
|
168
|
-
> (if such is needed) as the thrid argument and so on. For example:
|
|
169
|
-
> `driver.executeScript("windows: setValue", element, "valueToSet")` or
|
|
170
|
-
> `driver.executeScript("windows: invoke", element)`. Commands that are created
|
|
171
|
-
> as fallbacks to Appium Windows Driver should work as is. Open an issue if some
|
|
172
|
-
> command that you need is missing or is not behaving as it should.
|
|
173
|
-
|
|
174
|
-
```java
|
|
175
|
-
// Java 11+
|
|
176
|
-
var result = driver.executeScript("windows: <methodName>", Map.of(
|
|
177
|
-
"arg1", "value1",
|
|
178
|
-
"arg2", "value2"
|
|
179
|
-
// you may add more pairs if needed or skip providing the map completely
|
|
180
|
-
// if all arguments are defined as optional
|
|
181
|
-
));
|
|
182
|
-
```
|
|
126
|
+
```javascript
|
|
127
|
+
// Execute a command string
|
|
128
|
+
await driver.executeScript('powerShell', { command: 'Get-Process Notepad' });
|
|
183
129
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const result = await driver.executeScript('windows: <methodName>', [{
|
|
187
|
-
arg1: "value1",
|
|
188
|
-
arg2: "value2",
|
|
189
|
-
}]);
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
```python
|
|
193
|
-
# Python
|
|
194
|
-
result = driver.execute_script('windows: <methodName>', {
|
|
195
|
-
'arg1': 'value1',
|
|
196
|
-
'arg2': 'value2',
|
|
197
|
-
})
|
|
198
|
-
```
|
|
130
|
+
// Execute a script string
|
|
131
|
+
await driver.executeScript('powerShell', { script: '$p = Get-Process Notepad; $p.Kill();' });
|
|
199
132
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
result = @driver.execute_script 'windows: <methodName>', {
|
|
203
|
-
arg1: 'value1',
|
|
204
|
-
arg2: 'value2',
|
|
205
|
-
}
|
|
133
|
+
// Shorthand (executes as command/script depending on context)
|
|
134
|
+
await driver.executeScript('powerShell', 'Get-Process');
|
|
206
135
|
```
|
|
207
136
|
|
|
208
|
-
|
|
209
|
-
// Dotnet
|
|
210
|
-
object result = driver.ExecuteScript("windows: <methodName>", new Dictionary<string, object>() {
|
|
211
|
-
{"arg1", "value1"},
|
|
212
|
-
{"arg2", "value2"}
|
|
213
|
-
});
|
|
214
|
-
```
|
|
137
|
+
---
|
|
215
138
|
|
|
216
|
-
|
|
139
|
+
## 🛠 Platform-Specific Extensions
|
|
217
140
|
|
|
218
|
-
|
|
141
|
+
All extensions are invoked via `driver.executeScript("windows: <methodName>", ...args)`.
|
|
142
|
+
Below are the detailed descriptions and arguments for each command.
|
|
219
143
|
|
|
220
|
-
|
|
144
|
+
> **Note**
|
|
145
|
+
> In most cases, commands can be used more intuitively by passing the element as the first argument (if required) and other parameters subsequently.
|
|
221
146
|
|
|
222
|
-
|
|
223
|
-
--- | --- | --- | --- | ---
|
|
224
|
-
elementId | string | no | Hexadecimal identifier of the element to click on. If this parameter is missing then given coordinates will be parsed as absolute ones. Otherwise they are parsed as relative to the top left corner of this element. | 123e4567-e89b-12d3-a456-426614174000
|
|
225
|
-
x | number | no | Integer horizontal coordinate of the click point. Both x and y coordinates must be provided or none of them if elementId is present. In such case the gesture will be performed at the center point of the given element. The screen scale (if customized) is **not** taken into consideration while calculating the coordinate. The coordinate is always calculated for the [virtual screen](https://learn.microsoft.com/en-us/windows/win32/gdi/the-virtual-screen). | 100
|
|
226
|
-
y | number | no | Integer vertical coordinate of the click point. Both x and y coordinates must be provided or none of them if elementId is present. In such case the gesture will be performed at the center point of the given element. The screen scale (if customized) is **not** taken into consideration while calculating the coordinate. The coordinate is always calculated for the [virtual screen](https://learn.microsoft.com/en-us/windows/win32/gdi/the-virtual-screen). | 100
|
|
227
|
-
button | string | no | Name of the mouse button to be clicked. An exception is thrown if an unknown button name is provided. Supported button names are: left, middle, right, back, forward. The default value is `left` | right
|
|
228
|
-
modifierKeys | string[] or string | no | List of possible keys or a single key name to depress while the click is being performed. Supported key names are: Shift, Ctrl, Alt, Win. For example, in order to keep Ctrl+Alt depressed while clicking, provide the value of ['ctrl', 'alt'] | win
|
|
229
|
-
durationMs | number | no | The number of milliseconds to wait between pressing and releasing the mouse button. By default no delay is applied, which simulates a regular click. | 500
|
|
230
|
-
times | number | no | How many times the click must be performed. One by default. | 2
|
|
231
|
-
interClickDelayMs | number | no | Duration of the pause between each click gesture. Only makes sense if `times` is greater than one. 100ms by default. | 10
|
|
147
|
+
### Mouse & Pointer
|
|
232
148
|
|
|
233
|
-
|
|
149
|
+
#### `windows: click`
|
|
150
|
+
This is a shortcut for a single mouse click gesture.
|
|
234
151
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
152
|
+
| Name | Type | Required | Description | Example |
|
|
153
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
154
|
+
| `elementId` | `string` | no | Hexadecimal identifier of the element to click on. If this parameter is missing then given coordinates will be parsed as absolute ones. Otherwise they are parsed as relative to the top left corner of this element. | `123e4567-e89b...` |
|
|
155
|
+
| `x` | `number` | no | Integer horizontal coordinate of the click point. Both x and y coordinates must be provided or none of them if elementId is present. | `100` |
|
|
156
|
+
| `y` | `number` | no | Integer vertical coordinate of the click point. Both x and y coordinates must be provided or none of them if elementId is present. | `100` |
|
|
157
|
+
| `button` | `string` | no | Name of the mouse button to be clicked. Supported button names are: `left`, `middle`, `right`, `back`, `forward`. The default value is `left`. | `right` |
|
|
158
|
+
| `modifierKeys` | `string[]` \| `string` | no | List of possible keys or a single key name to depress while the click is being performed. Supported key names are: `Shift`, `Ctrl`, `Alt`, `Win`. | `['ctrl', 'alt']` |
|
|
159
|
+
| `durationMs` | `number` | no | The number of milliseconds to wait between pressing and releasing the mouse button. By default no delay is applied. | `500` |
|
|
160
|
+
| `times` | `number` | no | How many times the click must be performed. One by default. | `2` |
|
|
161
|
+
| `interClickDelayMs` | `number` | no | Duration of the pause between each click gesture. Only makes sense if `times` is greater than one. 100ms by default. | `10` |
|
|
162
|
+
|
|
163
|
+
#### Usage
|
|
164
|
+
```python
|
|
165
|
+
driver.execute_script('windows: click', {
|
|
166
|
+
'elementId': element.id,
|
|
167
|
+
'button': 'right',
|
|
168
|
+
'times': 2,
|
|
169
|
+
'modifierKeys': ['ctrl', 'alt']
|
|
170
|
+
})
|
|
171
|
+
```
|
|
238
172
|
|
|
239
|
-
####
|
|
173
|
+
#### `windows: scroll`
|
|
174
|
+
This is a shortcut for a mouse wheel scroll gesture. The API is a thin wrapper over the SendInput WinApi call.
|
|
240
175
|
|
|
241
|
-
Name | Type | Required | Description | Example
|
|
242
|
-
|
|
243
|
-
elementId | string | no | Same as in
|
|
244
|
-
x | number | no | Same as in
|
|
245
|
-
y | number | no | Same as in
|
|
246
|
-
deltaX | number | no | The amount of horizontal wheel movement measured in wheel clicks.
|
|
247
|
-
deltaY | number | no | The amount of vertical wheel movement
|
|
248
|
-
modifierKeys | string[]
|
|
176
|
+
| Name | Type | Required | Description | Example |
|
|
177
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
178
|
+
| `elementId` | `string` | no | Same as in `windows: click`. | `123e4567-e89b...` |
|
|
179
|
+
| `x` | `number` | no | Same as in `windows: click`. | `100` |
|
|
180
|
+
| `y` | `number` | no | Same as in `windows: click`. | `100` |
|
|
181
|
+
| `deltaX` | `number` | no | The amount of horizontal wheel movement measured in wheel clicks. Positive = right, Negative = left. | `-5` |
|
|
182
|
+
| `deltaY` | `number` | no | The amount of vertical wheel movement. Positive = forward (away), Negative = backward (toward). | `5` |
|
|
183
|
+
| `modifierKeys` | `string[]` \| `string` | no | Same as in `windows: click`. | `win` |
|
|
249
184
|
|
|
250
|
-
|
|
185
|
+
#### Usage
|
|
186
|
+
```python
|
|
187
|
+
driver.execute_script('windows: scroll', {
|
|
188
|
+
'elementId': element.id,
|
|
189
|
+
'deltaY': -5, # Scroll down 5 clicks
|
|
190
|
+
'modifierKeys': 'shift'
|
|
191
|
+
})
|
|
192
|
+
```
|
|
251
193
|
|
|
194
|
+
#### `windows: hover`
|
|
252
195
|
This is a shortcut for a hover gesture.
|
|
253
196
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
197
|
+
| Name | Type | Required | Description | Example |
|
|
198
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
199
|
+
| `startElementId` | `string` | no | Same as in `windows: click`. | `123e4567-e89b...` |
|
|
200
|
+
| `startX` | `number` | no | Same as in `windows: click`. | `100` |
|
|
201
|
+
| `startY` | `number` | no | Same as in `windows: click`. | `100` |
|
|
202
|
+
| `endElementId` | `string` | no | Same as in `windows: click`. | `123e4567-e89b...` |
|
|
203
|
+
| `endX` | `number` | no | Same as in `windows: click`. | `200` |
|
|
204
|
+
| `endY` | `number` | no | Same as in `windows: click`. | `200` |
|
|
205
|
+
| `modifierKeys` | `string[]` \| `string` | no | Same as in `windows: click`. | `shift` |
|
|
206
|
+
| `durationMs` | `number` | no | The number of milliseconds between moving the cursor from the starting to the ending hover point. 500ms by default. | `700` |
|
|
207
|
+
|
|
208
|
+
#### Usage
|
|
209
|
+
```python
|
|
210
|
+
driver.execute_script('windows: hover', {
|
|
211
|
+
'startElementId': element1.id,
|
|
212
|
+
'endElementId': element2.id,
|
|
213
|
+
'durationMs': 1000
|
|
214
|
+
})
|
|
215
|
+
```
|
|
266
216
|
|
|
267
|
-
###
|
|
217
|
+
### Keyboard
|
|
268
218
|
|
|
269
|
-
|
|
219
|
+
#### `windows: keys`
|
|
220
|
+
This is a shortcut for a customized keyboard input. Selenium keys should also work as modifier keys.
|
|
270
221
|
|
|
271
|
-
|
|
222
|
+
| Name | Type | Required | Description | Example |
|
|
223
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
224
|
+
| `actions` | `KeyAction[]` \| `KeyAction` | yes | One or more KeyAction dictionaries. | `[{'virtualKeyCode': 0x10, 'down': true}]` |
|
|
225
|
+
| `forceUnicode` | `boolean` | no | Forces the characters to be sent as unicode characters. | `true` |
|
|
272
226
|
|
|
273
|
-
|
|
274
|
-
--- | --- | --- | --- | ---
|
|
275
|
-
actions | KeyAction[] or KeyAction | yes | One or more [KeyAction](#keyaction) dictionaries | ```json [{"virtualKeyCode": 0x10, "down": true}, {'text': "appium likes you"}, {"virtualKeyCode": 0x10, "down": false}]```
|
|
276
|
-
forceUnicode | boolean | no | Forces the characters to be sent as unicode characters. Note that they won't work in keyboard shortcut combinations, but it makes them keyboard-layout independent. | true
|
|
227
|
+
##### KeyAction Dictionary
|
|
277
228
|
|
|
278
|
-
|
|
229
|
+
| Name | Type | Required | Description | Example |
|
|
230
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
231
|
+
| `pause` | `number` | no | Allows to set a delay in milliseconds between key input series. | `100` |
|
|
232
|
+
| `text` | `string` | no | Non-empty string of Unicode text to type. | `Hello` |
|
|
233
|
+
| `virtualKeyCode` | `number` | no | Valid virtual key code. | `0x10` |
|
|
234
|
+
| `down` | `boolean` | no | If set to `true` then the corresponding key will be depressed, `false` - released. | `true` |
|
|
279
235
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
virtualKeyCode
|
|
285
|
-
|
|
236
|
+
#### Usage
|
|
237
|
+
```python
|
|
238
|
+
driver.execute_script('windows: keys', {
|
|
239
|
+
'actions': [
|
|
240
|
+
{'virtualKeyCode': 0x10, 'down': True}, # Shift Down
|
|
241
|
+
{'text': 'Hello World'},
|
|
242
|
+
{'virtualKeyCode': 0x10, 'down': False} # Shift Up
|
|
243
|
+
]
|
|
244
|
+
})
|
|
245
|
+
```
|
|
286
246
|
|
|
287
|
-
###
|
|
247
|
+
### System & State
|
|
288
248
|
|
|
249
|
+
#### `windows: setClipboard`
|
|
289
250
|
Sets Windows clipboard content to the given text or a PNG image.
|
|
290
251
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
b64Content | string | yes | Base64-encoded content of the clipboard to be set | `QXBwaXVt`
|
|
296
|
-
contentType | 'plaintext' or 'image' | no | Set to 'plaintext' in order to set the given text to the clipboard (the default value). Set to 'image' if `b64Content` contains a base64-encoded payload of a PNG image. | image
|
|
252
|
+
| Name | Type | Required | Description | Example |
|
|
253
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
254
|
+
| `b64Content` | `string` | yes | Base64-encoded content of the clipboard to be set. | `QXBwaXVt` |
|
|
255
|
+
| `contentType` | `string` | no | Set to `plaintext` (default) or `image`. | `image` |
|
|
297
256
|
|
|
298
|
-
|
|
257
|
+
#### Usage
|
|
258
|
+
```python
|
|
259
|
+
driver.execute_script('windows: setClipboard', {
|
|
260
|
+
'b64Content': 'SGVsbG8=', # "Hello" in Base64
|
|
261
|
+
'contentType': 'plaintext'
|
|
262
|
+
})
|
|
263
|
+
```
|
|
299
264
|
|
|
265
|
+
#### `windows: getClipboard`
|
|
300
266
|
Retrieves Windows clipboard content.
|
|
301
267
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
--- | --- | --- | --- | ---
|
|
306
|
-
contentType | 'plaintext' or 'image' | no | Set to 'plaintext' in order to set the given text to the clipboard (the default value). Set to 'image' to retrieve a base64-encoded payload of a PNG image. | image
|
|
268
|
+
| Name | Type | Required | Description | Example |
|
|
269
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
270
|
+
| `contentType` | `string` | no | Set to `plaintext` (default) or `image`. | `image` |
|
|
307
271
|
|
|
308
|
-
####
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
272
|
+
#### Usage
|
|
273
|
+
```python
|
|
274
|
+
content = driver.execute_script('windows: getClipboard', {
|
|
275
|
+
'contentType': 'plaintext'
|
|
276
|
+
})
|
|
277
|
+
print(content)
|
|
278
|
+
```
|
|
313
279
|
|
|
314
|
-
|
|
280
|
+
#### `windows: pushCacheRequest`
|
|
281
|
+
This is an asynchronous function that sends cache requests based on specific conditions.
|
|
315
282
|
|
|
316
|
-
|
|
283
|
+
| Name | Type | Required | Description | Example |
|
|
284
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
285
|
+
| `treeFilter` | `string` | yes | Defines the filter that is applied when walking the automation tree. | `RawView` |
|
|
286
|
+
| `treeScope` | `string` | no | Defines the scope of the automation tree to be cached. | `SubTree` |
|
|
287
|
+
| `automationElementMode` | `string` | no | Specifies the mode of automation element (e.g., `None`, `Full`). | `Full` |
|
|
317
288
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
289
|
+
#### Usage
|
|
290
|
+
```python
|
|
291
|
+
driver.execute_script('windows: pushCacheRequest', {
|
|
292
|
+
'treeFilter': 'RawView',
|
|
293
|
+
'treeScope': 'SubTree'
|
|
294
|
+
})
|
|
295
|
+
```
|
|
323
296
|
|
|
324
|
-
###
|
|
297
|
+
### Element Operations
|
|
325
298
|
|
|
299
|
+
#### `windows: invoke`
|
|
326
300
|
Invokes a UI element pattern, simulating an interaction like clicking or activating the element.
|
|
327
301
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
| --- | --- | --- | --- |
|
|
332
|
-
1 | `Element` | The UI element on which the `InvokePattern` is called to simulate activation. | `element`
|
|
333
|
-
|
|
334
|
-
### windows: expand
|
|
335
|
-
|
|
336
|
-
Expands a UI element that supports the `ExpandPattern`, typically used for elements that can be expanded (like trees or combo boxes).
|
|
337
|
-
|
|
338
|
-
#### Arguments
|
|
302
|
+
| Position | Type | Description | Example |
|
|
303
|
+
| :--- | :--- | :--- | :--- |
|
|
304
|
+
| 1 | `Element` | The UI element on which the `InvokePattern` is called. | `element` |
|
|
339
305
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
### windows: collapse
|
|
345
|
-
|
|
346
|
-
Collapses a UI element that supports the `CollapsePattern`, typically used for collapsible elements (like tree nodes).
|
|
347
|
-
|
|
348
|
-
#### Arguments
|
|
349
|
-
|
|
350
|
-
Position | Type | Description | Example
|
|
351
|
-
| --- | --- | --- | --- |
|
|
352
|
-
1 | `Element` | The UI element on which the `CollapsePattern` is called to collapse the element. | `element`
|
|
353
|
-
|
|
354
|
-
### windows: scrollIntoView
|
|
306
|
+
#### Usage
|
|
307
|
+
```python
|
|
308
|
+
driver.execute_script('windows: invoke', element)
|
|
309
|
+
```
|
|
355
310
|
|
|
356
|
-
|
|
311
|
+
#### `windows: expand`
|
|
312
|
+
Expands a UI element that supports the `ExpandPattern`.
|
|
357
313
|
|
|
358
|
-
|
|
314
|
+
| Position | Type | Description | Example |
|
|
315
|
+
| :--- | :--- | :--- | :--- |
|
|
316
|
+
| 1 | `Element` | The UI element to expand. | `element` |
|
|
359
317
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
318
|
+
#### Usage
|
|
319
|
+
```python
|
|
320
|
+
driver.execute_script('windows: expand', element)
|
|
321
|
+
```
|
|
363
322
|
|
|
364
|
-
|
|
323
|
+
#### `windows: collapse`
|
|
324
|
+
Collapses a UI element that supports the `CollapsePattern`.
|
|
365
325
|
|
|
366
|
-
|
|
326
|
+
| Position | Type | Description | Example |
|
|
327
|
+
| :--- | :--- | :--- | :--- |
|
|
328
|
+
| 1 | `Element` | The UI element to collapse. | `element` |
|
|
367
329
|
|
|
368
|
-
####
|
|
330
|
+
#### Usage
|
|
331
|
+
```python
|
|
332
|
+
driver.execute_script('windows: collapse', element)
|
|
333
|
+
```
|
|
369
334
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
1 | `Element` | The UI element to check for multiple selection support. | `element`
|
|
335
|
+
#### `windows: setValue`
|
|
336
|
+
Sets the value of a UI element using the `ValuePattern`.
|
|
373
337
|
|
|
374
|
-
|
|
338
|
+
| Position | Type | Description | Example |
|
|
339
|
+
| :--- | :--- | :--- | :--- |
|
|
340
|
+
| 1 | `Element` | The UI element whose value will be set. | `element` |
|
|
341
|
+
| 2 | `string` | The value to be set. | `"new value"` |
|
|
375
342
|
|
|
376
|
-
|
|
343
|
+
#### Usage
|
|
344
|
+
```python
|
|
345
|
+
driver.execute_script('windows: setValue', element, 'New Value')
|
|
346
|
+
```
|
|
377
347
|
|
|
378
|
-
|
|
348
|
+
#### `windows: getValue`
|
|
349
|
+
Gets the current value of a UI element that supports the `ValuePattern`.
|
|
379
350
|
|
|
380
|
-
|
|
351
|
+
| Position | Type | Description | Example |
|
|
352
|
+
| :--- | :--- | :--- | :--- |
|
|
353
|
+
| 1 | `Element` | The UI element from which to retrieve the value. | `element` |
|
|
381
354
|
|
|
382
|
-
####
|
|
355
|
+
#### Usage
|
|
356
|
+
```python
|
|
357
|
+
value = driver.execute_script('windows: getValue', element)
|
|
358
|
+
```
|
|
383
359
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
1 | `Element` | The UI element from which to retrieve the selected item. | `element`
|
|
360
|
+
#### `windows: scrollIntoView`
|
|
361
|
+
Scrolls the UI element into view using the `ScrollItemPattern`.
|
|
387
362
|
|
|
388
|
-
|
|
363
|
+
| Position | Type | Description | Example |
|
|
364
|
+
| :--- | :--- | :--- | :--- |
|
|
365
|
+
| 1 | `Element` | The UI element to bring into view. | `element` |
|
|
389
366
|
|
|
390
|
-
|
|
367
|
+
#### Usage
|
|
368
|
+
```python
|
|
369
|
+
driver.execute_script('windows: scrollIntoView', element)
|
|
370
|
+
```
|
|
391
371
|
|
|
392
|
-
|
|
372
|
+
#### `windows: toggle`
|
|
373
|
+
Toggles a UI element’s state using the `TogglePattern`.
|
|
393
374
|
|
|
394
|
-
|
|
375
|
+
| Position | Type | Description | Example |
|
|
376
|
+
| :--- | :--- | :--- | :--- |
|
|
377
|
+
| 1 | `Element` | The UI element to toggle. | `element` |
|
|
395
378
|
|
|
396
|
-
####
|
|
379
|
+
#### Usage
|
|
380
|
+
```python
|
|
381
|
+
driver.execute_script('windows: toggle', element)
|
|
382
|
+
```
|
|
397
383
|
|
|
398
|
-
|
|
399
|
-
| --- | --- | --- | --- |
|
|
400
|
-
1 | `Element` | The UI element from which to retrieve all selected items. | `element`
|
|
384
|
+
### Selection Management
|
|
401
385
|
|
|
402
|
-
####
|
|
386
|
+
#### `windows: select`
|
|
387
|
+
Selects a UI element using the `SelectionPattern`.
|
|
403
388
|
|
|
404
|
-
|
|
389
|
+
| Position | Type | Description | Example |
|
|
390
|
+
| :--- | :--- | :--- | :--- |
|
|
391
|
+
| 1 | `Element` | The UI element to select. | `element` |
|
|
405
392
|
|
|
406
|
-
|
|
393
|
+
#### Usage
|
|
394
|
+
```python
|
|
395
|
+
driver.execute_script('windows: select', element)
|
|
396
|
+
```
|
|
407
397
|
|
|
398
|
+
#### `windows: addToSelection`
|
|
408
399
|
Adds an element to the current selection on a UI element that supports the `SelectionPattern`.
|
|
409
400
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
| --- | --- | --- | --- |
|
|
414
|
-
1 | `Element` | The UI element to add to the selection. | `element`
|
|
401
|
+
| Position | Type | Description | Example |
|
|
402
|
+
| :--- | :--- | :--- | :--- |
|
|
403
|
+
| 1 | `Element` | The UI element to add to the selection. | `element` |
|
|
415
404
|
|
|
416
|
-
|
|
405
|
+
#### Usage
|
|
406
|
+
```python
|
|
407
|
+
driver.execute_script('windows: addToSelection', element)
|
|
408
|
+
```
|
|
417
409
|
|
|
410
|
+
#### `windows: removeFromSelection`
|
|
418
411
|
Removes an element from the current selection on a UI element that supports the `SelectionPattern`.
|
|
419
412
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
| --- | --- | --- | --- |
|
|
424
|
-
1 | `Element` | The UI element to remove from the selection. | `element`
|
|
425
|
-
|
|
426
|
-
### windows: select
|
|
427
|
-
|
|
428
|
-
Selects a UI element using the `SelectionPattern`, simulating the action of choosing the element in a selection context.
|
|
429
|
-
|
|
430
|
-
#### Arguments
|
|
431
|
-
|
|
432
|
-
Position | Type | Description | Example
|
|
433
|
-
| --- | --- | --- | --- |
|
|
434
|
-
1 | `Element` | The UI element to select. | `element`
|
|
435
|
-
|
|
436
|
-
### windows: toggle
|
|
413
|
+
| Position | Type | Description | Example |
|
|
414
|
+
| :--- | :--- | :--- | :--- |
|
|
415
|
+
| 1 | `Element` | The UI element to remove from the selection. | `element` |
|
|
437
416
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
417
|
+
#### Usage
|
|
418
|
+
```python
|
|
419
|
+
driver.execute_script('windows: removeFromSelection', element)
|
|
420
|
+
```
|
|
441
421
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
1 | `Element` | The UI element to toggle. | `element`
|
|
422
|
+
#### `windows: isMultiple`
|
|
423
|
+
Checks if a UI element supports multiple selection using the `SelectionPattern`.
|
|
445
424
|
|
|
446
|
-
|
|
425
|
+
| Position | Type | Description | Example |
|
|
426
|
+
| :--- | :--- | :--- | :--- |
|
|
427
|
+
| 1 | `Element` | The UI element to check. | `element` |
|
|
447
428
|
|
|
448
|
-
|
|
429
|
+
#### Usage
|
|
430
|
+
```python
|
|
431
|
+
is_multi = driver.execute_script('windows: isMultiple', element)
|
|
432
|
+
```
|
|
449
433
|
|
|
450
|
-
####
|
|
434
|
+
#### `windows: selectedItem`
|
|
435
|
+
Gets the selected item from a UI element that supports the `SelectionPattern`.
|
|
451
436
|
|
|
452
|
-
Position | Type | Description | Example
|
|
453
|
-
|
|
|
454
|
-
1 | `Element` | The UI element
|
|
455
|
-
2 | `string` | The value to be set on the element. | `"new value"`
|
|
437
|
+
| Position | Type | Description | Example |
|
|
438
|
+
| :--- | :--- | :--- | :--- |
|
|
439
|
+
| 1 | `Element` | The UI element from which to retrieve the selected item. | `element` |
|
|
456
440
|
|
|
457
|
-
|
|
441
|
+
#### Usage
|
|
442
|
+
```python
|
|
443
|
+
selected_el = driver.execute_script('windows: selectedItem', element)
|
|
444
|
+
```
|
|
458
445
|
|
|
459
|
-
|
|
446
|
+
#### `windows: allSelectedItems`
|
|
447
|
+
Gets all selected items from a UI element that supports the `SelectionPattern`.
|
|
460
448
|
|
|
461
|
-
|
|
449
|
+
| Position | Type | Description | Example |
|
|
450
|
+
| :--- | :--- | :--- | :--- |
|
|
451
|
+
| 1 | `Element` | The UI element from which to retrieve all selected items. | `element` |
|
|
462
452
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
453
|
+
#### Usage
|
|
454
|
+
```python
|
|
455
|
+
selected_els = driver.execute_script('windows: allSelectedItems', element)
|
|
456
|
+
```
|
|
466
457
|
|
|
467
|
-
###
|
|
458
|
+
### Window Management
|
|
468
459
|
|
|
460
|
+
#### `windows: maximize`
|
|
469
461
|
Maximizes a window or UI element using the `WindowPattern`.
|
|
470
462
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
| --- | --- | --- | --- |
|
|
475
|
-
1 | `Element` | The window or UI element to maximize. | `element`
|
|
463
|
+
| Position | Type | Description | Example |
|
|
464
|
+
| :--- | :--- | :--- | :--- |
|
|
465
|
+
| 1 | `Element` | The window or UI element to maximize. | `element` |
|
|
476
466
|
|
|
477
|
-
|
|
467
|
+
#### Usage
|
|
468
|
+
```python
|
|
469
|
+
driver.execute_script('windows: maximize', element)
|
|
470
|
+
```
|
|
478
471
|
|
|
472
|
+
#### `windows: minimize`
|
|
479
473
|
Minimizes a window or UI element using the `WindowPattern`.
|
|
480
474
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
| --- | --- | --- | --- |
|
|
485
|
-
1 | `Element` | The window or UI element to minimize. | `element`
|
|
486
|
-
|
|
487
|
-
### windows: restore
|
|
475
|
+
| Position | Type | Description | Example |
|
|
476
|
+
| :--- | :--- | :--- | :--- |
|
|
477
|
+
| 1 | `Element` | The window or UI element to minimize. | `element` |
|
|
488
478
|
|
|
489
|
-
|
|
479
|
+
#### Usage
|
|
480
|
+
```python
|
|
481
|
+
driver.execute_script('windows: minimize', element)
|
|
482
|
+
```
|
|
490
483
|
|
|
491
|
-
####
|
|
484
|
+
#### `windows: restore`
|
|
485
|
+
Restores a window or UI element to its normal state using the `WindowPattern`.
|
|
492
486
|
|
|
493
|
-
Position | Type | Description | Example
|
|
494
|
-
|
|
|
495
|
-
1 | `Element` | The window or UI element to restore. | `element`
|
|
487
|
+
| Position | Type | Description | Example |
|
|
488
|
+
| :--- | :--- | :--- | :--- |
|
|
489
|
+
| 1 | `Element` | The window or UI element to restore. | `element` |
|
|
496
490
|
|
|
497
|
-
|
|
491
|
+
#### Usage
|
|
492
|
+
```python
|
|
493
|
+
driver.execute_script('windows: restore', element)
|
|
494
|
+
```
|
|
498
495
|
|
|
496
|
+
#### `windows: close`
|
|
499
497
|
Closes a window or UI element using the `WindowPattern`.
|
|
500
498
|
|
|
501
|
-
|
|
499
|
+
| Position | Type | Description | Example |
|
|
500
|
+
| :--- | :--- | :--- | :--- |
|
|
501
|
+
| 1 | `Element` | The window or UI element to close. | `element` |
|
|
502
502
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
### windows: setFocus
|
|
503
|
+
#### Usage
|
|
504
|
+
```python
|
|
505
|
+
driver.execute_script('windows: close', element)
|
|
506
|
+
```
|
|
508
507
|
|
|
508
|
+
#### `windows: setFocus`
|
|
509
509
|
Sets focus to the specified UI element using UIAutomationElement's `SetFocus` method.
|
|
510
510
|
|
|
511
|
-
|
|
511
|
+
| Position | Type | Description | Example |
|
|
512
|
+
| :--- | :--- | :--- | :--- |
|
|
513
|
+
| 1 | `Element` | The UI element to set focus on. | `element` |
|
|
512
514
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
### windows: startRecordingScreen
|
|
518
|
-
|
|
519
|
-
To be implemented.
|
|
520
|
-
|
|
521
|
-
### windows: stopRecordingScreen
|
|
522
|
-
|
|
523
|
-
To be implemented.
|
|
524
|
-
|
|
525
|
-
### windows: deleteFile
|
|
526
|
-
|
|
527
|
-
To be implemented.
|
|
528
|
-
|
|
529
|
-
### windows: deleteFolder
|
|
530
|
-
|
|
531
|
-
To be implemented.
|
|
532
|
-
|
|
533
|
-
### windows: launchApp
|
|
534
|
-
|
|
535
|
-
To be implemented.
|
|
536
|
-
|
|
537
|
-
### windows: closeApp
|
|
538
|
-
|
|
539
|
-
To be implemented.
|
|
540
|
-
|
|
541
|
-
### windows: clickAndDrag
|
|
515
|
+
#### Usage
|
|
516
|
+
```python
|
|
517
|
+
driver.execute_script('windows: setFocus', element)
|
|
518
|
+
```
|
|
542
519
|
|
|
543
|
-
|
|
520
|
+
---
|
|
544
521
|
|
|
545
|
-
## Development
|
|
522
|
+
## 🛠 Development
|
|
546
523
|
|
|
547
|
-
|
|
548
|
-
Visual Studio Code plugin so it highlights the powershell and C code used throughout the project.
|
|
524
|
+
Recommended VS Code plugin: [Comment tagged templates](https://marketplace.visualstudio.com/items?itemName=bierner.comment-tagged-templates) for syntax highlighting.
|
|
549
525
|
|
|
550
526
|
```bash
|
|
551
|
-
#
|
|
552
|
-
npm
|
|
553
|
-
#
|
|
554
|
-
npm run lint
|
|
555
|
-
# Transpile TypeScript files to build the project
|
|
556
|
-
npm run build
|
|
527
|
+
npm install # Setup dependencies
|
|
528
|
+
npm run lint # Code quality check
|
|
529
|
+
npm run build # Transpile TypeScript to JS
|
|
557
530
|
```
|