appium-novawindows2-driver 1.1.21 → 1.1.22
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/LICENSE +201 -201
- package/README.md +716 -716
- package/build/lib/commands/app.js +14 -14
- package/build/lib/commands/extension.js +14 -14
- package/build/lib/commands/file.js +26 -26
- package/build/lib/commands/functions.js +380 -380
- package/build/lib/commands/index.d.ts +3 -3
- package/build/lib/commands/index.d.ts.map +1 -1
- package/build/lib/driver.js +9 -9
- package/build/lib/powershell/elements.js +544 -544
- package/build/lib/powershell/win32.js +807 -807
- package/package.json +86 -85
|
@@ -22,20 +22,20 @@ const util_1 = require("../util");
|
|
|
22
22
|
const base_driver_1 = require("@appium/base-driver");
|
|
23
23
|
const user32_1 = require("../winapi/user32");
|
|
24
24
|
const enums_1 = require("../enums");
|
|
25
|
-
const GET_PAGE_SOURCE_COMMAND = (0, powershell_1.pwsh$ /* ps1 */) `
|
|
26
|
-
$el = ${0};
|
|
27
|
-
|
|
28
|
-
if ($el -eq $null) {
|
|
29
|
-
$el = [AutomationElement]::RootElement;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
$source = Get-PageSource $el;
|
|
33
|
-
if ($null -ne $source) {
|
|
34
|
-
$source.OuterXml;
|
|
35
|
-
} else {
|
|
36
|
-
# Final fallback if even Get-PageSource fails for some reason
|
|
37
|
-
'<DummyRoot />';
|
|
38
|
-
}
|
|
25
|
+
const GET_PAGE_SOURCE_COMMAND = (0, powershell_1.pwsh$ /* ps1 */) `
|
|
26
|
+
$el = ${0};
|
|
27
|
+
|
|
28
|
+
if ($el -eq $null) {
|
|
29
|
+
$el = [AutomationElement]::RootElement;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$source = Get-PageSource $el;
|
|
33
|
+
if ($null -ne $source) {
|
|
34
|
+
$source.OuterXml;
|
|
35
|
+
} else {
|
|
36
|
+
# Final fallback if even Get-PageSource fails for some reason
|
|
37
|
+
'<DummyRoot />';
|
|
38
|
+
}
|
|
39
39
|
`;
|
|
40
40
|
async function getPageSource() {
|
|
41
41
|
return await this.sendPowerShellCommand(GET_PAGE_SOURCE_COMMAND.format(powershell_1.AutomationElement.automationRoot));
|
|
@@ -87,20 +87,20 @@ const AUTOMATION_ELEMENT_MODE = (0, util_1.$ /* ps1 */) `$cacheRequest.Pop(); $c
|
|
|
87
87
|
const SET_PLAINTEXT_CLIPBOARD_FROM_BASE64 = (0, util_1.$ /* ps1 */) `Set-Clipboard -Value ([System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('${0}')))`;
|
|
88
88
|
const GET_PLAINTEXT_CLIPBOARD_BASE64 = /* ps1 */ `[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes((Get-Clipboard -Raw)))`;
|
|
89
89
|
const SET_IMAGE_CLIPBOARD_FROM_BASE64 = (0, util_1.$ /* ps1 */) `$b = [Convert]::FromBase64String('${0}'); $s = New-Object IO.MemoryStream; $s.Write($b, 0, $b.Length); $s.Position = 0; $i = [System.Windows.Media.Imaging.BitmapFrame]::Create($s); [Windows.Clipboard]::SetImage($i); $s.Close()`;
|
|
90
|
-
const GET_IMAGE_CLIPBOARD_BASE64 = (0, powershell_1.pwsh /* ps1 */) `
|
|
91
|
-
[Windows.Clipboard]::GetImage() | ForEach-Object {
|
|
92
|
-
if ($_ -ne $null) {
|
|
93
|
-
$stream = New-Object IO.MemoryStream;
|
|
94
|
-
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder;
|
|
95
|
-
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($_));
|
|
96
|
-
$encoder.Save($stream);
|
|
97
|
-
$stream.Position = 0;
|
|
98
|
-
$bytes = $stream.ToArray();
|
|
99
|
-
$base64String = [Convert]::ToBase64String($bytes);
|
|
100
|
-
$stream.Close();
|
|
101
|
-
Write-Output $base64String;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
90
|
+
const GET_IMAGE_CLIPBOARD_BASE64 = (0, powershell_1.pwsh /* ps1 */) `
|
|
91
|
+
[Windows.Clipboard]::GetImage() | ForEach-Object {
|
|
92
|
+
if ($_ -ne $null) {
|
|
93
|
+
$stream = New-Object IO.MemoryStream;
|
|
94
|
+
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder;
|
|
95
|
+
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($_));
|
|
96
|
+
$encoder.Save($stream);
|
|
97
|
+
$stream.Position = 0;
|
|
98
|
+
$bytes = $stream.ToArray();
|
|
99
|
+
$base64String = [Convert]::ToBase64String($bytes);
|
|
100
|
+
$stream.Close();
|
|
101
|
+
Write-Output $base64String;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
104
|
`;
|
|
105
105
|
const MODIFIER_KEY_MAP = {
|
|
106
106
|
ctrl: enums_1.Key.CONTROL,
|
|
@@ -11,44 +11,44 @@ async function pushFile(remotePath, base64Data) {
|
|
|
11
11
|
throw new base_driver_1.errors.InvalidArgumentError('pushFile: payload must be a base64-encoded string');
|
|
12
12
|
}
|
|
13
13
|
const escapedPath = remotePath.replace(/'/g, "''");
|
|
14
|
-
const command = `
|
|
15
|
-
$targetPath = '${escapedPath}';
|
|
16
|
-
$base64String = '${base64Data}';
|
|
17
|
-
$parentDir = Split-Path -Path $targetPath -Parent;
|
|
18
|
-
if (-not (Test-Path -Path $parentDir)) { New-Item -ItemType Directory -Force -Path $parentDir | Out-Null };
|
|
19
|
-
$bytes = [Convert]::FromBase64String($base64String);
|
|
20
|
-
[System.IO.File]::WriteAllBytes($targetPath, $bytes);
|
|
14
|
+
const command = `
|
|
15
|
+
$targetPath = '${escapedPath}';
|
|
16
|
+
$base64String = '${base64Data}';
|
|
17
|
+
$parentDir = Split-Path -Path $targetPath -Parent;
|
|
18
|
+
if (-not (Test-Path -Path $parentDir)) { New-Item -ItemType Directory -Force -Path $parentDir | Out-Null };
|
|
19
|
+
$bytes = [Convert]::FromBase64String($base64String);
|
|
20
|
+
[System.IO.File]::WriteAllBytes($targetPath, $bytes);
|
|
21
21
|
`;
|
|
22
22
|
await this.sendPowerShellCommand(command);
|
|
23
23
|
}
|
|
24
24
|
async function pullFile(remotePath) {
|
|
25
25
|
this.log.debug(`Pulling file from: ${remotePath}`);
|
|
26
26
|
const escapedPath = remotePath.replace(/'/g, "''");
|
|
27
|
-
const command = `
|
|
28
|
-
$targetPath = '${escapedPath}';
|
|
29
|
-
if (-not (Test-Path -Path $targetPath -PathType Leaf)) { throw "File not found: $targetPath" };
|
|
30
|
-
$bytes = [System.IO.File]::ReadAllBytes($targetPath);
|
|
31
|
-
[Convert]::ToBase64String($bytes);
|
|
27
|
+
const command = `
|
|
28
|
+
$targetPath = '${escapedPath}';
|
|
29
|
+
if (-not (Test-Path -Path $targetPath -PathType Leaf)) { throw "File not found: $targetPath" };
|
|
30
|
+
$bytes = [System.IO.File]::ReadAllBytes($targetPath);
|
|
31
|
+
[Convert]::ToBase64String($bytes);
|
|
32
32
|
`;
|
|
33
33
|
return await this.sendPowerShellCommand(command);
|
|
34
34
|
}
|
|
35
35
|
async function pullFolder(remotePath) {
|
|
36
36
|
this.log.debug(`Pulling folder from: ${remotePath}`);
|
|
37
37
|
const escapedPath = remotePath.replace(/'/g, "''");
|
|
38
|
-
const command = `
|
|
39
|
-
$targetPath = '${escapedPath}';
|
|
40
|
-
$tempGuid = [Guid]::NewGuid().ToString();
|
|
41
|
-
$zipPath = Join-Path $env:TEMP "appium_$tempGuid.zip";
|
|
42
|
-
if (-not (Test-Path -Path $targetPath -PathType Container)) { throw "Folder not found: $targetPath" };
|
|
43
|
-
try {
|
|
44
|
-
Compress-Archive -Path $targetPath -DestinationPath $zipPath -Force;
|
|
45
|
-
$bytes = [System.IO.File]::ReadAllBytes($zipPath);
|
|
46
|
-
[Convert]::ToBase64String($bytes);
|
|
47
|
-
} finally {
|
|
48
|
-
# Always clean up the staging zip, even if Compress-Archive or
|
|
49
|
-
# ReadAllBytes threw partway through.
|
|
50
|
-
Remove-Item -Path $zipPath -Force -ErrorAction SilentlyContinue;
|
|
51
|
-
}
|
|
38
|
+
const command = `
|
|
39
|
+
$targetPath = '${escapedPath}';
|
|
40
|
+
$tempGuid = [Guid]::NewGuid().ToString();
|
|
41
|
+
$zipPath = Join-Path $env:TEMP "appium_$tempGuid.zip";
|
|
42
|
+
if (-not (Test-Path -Path $targetPath -PathType Container)) { throw "Folder not found: $targetPath" };
|
|
43
|
+
try {
|
|
44
|
+
Compress-Archive -Path $targetPath -DestinationPath $zipPath -Force;
|
|
45
|
+
$bytes = [System.IO.File]::ReadAllBytes($zipPath);
|
|
46
|
+
[Convert]::ToBase64String($bytes);
|
|
47
|
+
} finally {
|
|
48
|
+
# Always clean up the staging zip, even if Compress-Archive or
|
|
49
|
+
# ReadAllBytes threw partway through.
|
|
50
|
+
Remove-Item -Path $zipPath -Force -ErrorAction SilentlyContinue;
|
|
51
|
+
}
|
|
52
52
|
`;
|
|
53
53
|
return await this.sendPowerShellCommand(command);
|
|
54
54
|
}
|