appium-novawindows2-driver 0.1.13 → 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.
@@ -2,195 +2,195 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PAGE_SOURCE = exports.FIND_CHILDREN_RECURSIVELY = void 0;
4
4
  const powershell_1 = require("../powershell");
5
- exports.FIND_CHILDREN_RECURSIVELY = (0, powershell_1.pwsh /* ps1 */) `
6
- function Find-ChildrenRecursively {
7
- param (
8
- [Parameter(Mandatory=$true)]
9
- [AutomationElement]$element,
10
- [Parameter(Mandatory=$true)]
11
- [Condition]$condition,
12
- [Parameter(Mandatory=$false)]
13
- [bool]$includeSelf = $false
14
- )
15
-
16
- $scope = if ($includeSelf) {
17
- [TreeScope]::Element -bor [TreeScope]::Children
18
- } else {
19
- [TreeScope]::Children
20
- }
21
-
22
- $validChild = $element.FindFirst($scope, $condition)
23
-
24
- if ($validChild -ne $null) {
25
- return $validChild
26
- }
27
-
28
- $children = $element.FindAll([TreeScope]::Children, [Condition]::TrueCondition)
29
- foreach ($child in $children) {
30
- $result = Find-AllChildrenRecursively -element $child -condition $condition -returnFirstResult $true
31
- if ($result -ne $null) {
32
- return $result[0]
33
- }
34
- }
35
-
36
- return $null
37
- }
38
-
39
- function Find-AllChildrenRecursively {
40
- param (
41
- [Parameter(Mandatory=$true)]
42
- [AutomationElement]$element,
43
- [Parameter(Mandatory=$true)]
44
- [Condition]$condition,
45
- [bool]$returnFirstResult = $false,
46
- [Parameter(Mandatory=$false)]
47
- [bool]$includeSelf = $false
48
- )
49
-
50
- $children = $element.FindAll([TreeScope]::Children, [Condition]::TrueCondition)
51
- $validChildren = @($children | Where-Object { $_.FindFirst([TreeScope]::Element, $condition) -ne $null })
52
-
53
- if ($includeSelf) {
54
- $self = $element.FindFirst([TreeScope]::Element, $condition)
55
- }
56
-
57
- if ($null -ne $self) {
58
- $validChildren += $self
59
- }
60
-
61
- foreach ($child in $children) {
62
- $Allresults = Find-AllChildrenRecursively -element $child -condition $condition
63
- if ($returnFirstResult -and $Allresults.Count -gt 0) {
64
- return $Allresults
65
- }
66
-
67
- foreach ($result in $Allresults) {
68
- $validChildren += ($result | Where-Object { $_.FindFirst([TreeScope]::Element, $condition) -ne $null })
69
- }
70
- }
71
-
72
- return $validChildren
73
- }
5
+ exports.FIND_CHILDREN_RECURSIVELY = (0, powershell_1.pwsh /* ps1 */) `
6
+ function Find-ChildrenRecursively {
7
+ param (
8
+ [Parameter(Mandatory=$true)]
9
+ [AutomationElement]$element,
10
+ [Parameter(Mandatory=$true)]
11
+ [Condition]$condition,
12
+ [Parameter(Mandatory=$false)]
13
+ [bool]$includeSelf = $false
14
+ )
15
+
16
+ $scope = if ($includeSelf) {
17
+ [TreeScope]::Element -bor [TreeScope]::Children
18
+ } else {
19
+ [TreeScope]::Children
20
+ }
21
+
22
+ $validChild = $element.FindFirst($scope, $condition)
23
+
24
+ if ($validChild -ne $null) {
25
+ return $validChild
26
+ }
27
+
28
+ $children = $element.FindAll([TreeScope]::Children, [Condition]::TrueCondition)
29
+ foreach ($child in $children) {
30
+ $result = Find-AllChildrenRecursively -element $child -condition $condition -returnFirstResult $true
31
+ if ($result -ne $null) {
32
+ return $result[0]
33
+ }
34
+ }
35
+
36
+ return $null
37
+ }
38
+
39
+ function Find-AllChildrenRecursively {
40
+ param (
41
+ [Parameter(Mandatory=$true)]
42
+ [AutomationElement]$element,
43
+ [Parameter(Mandatory=$true)]
44
+ [Condition]$condition,
45
+ [bool]$returnFirstResult = $false,
46
+ [Parameter(Mandatory=$false)]
47
+ [bool]$includeSelf = $false
48
+ )
49
+
50
+ $children = $element.FindAll([TreeScope]::Children, [Condition]::TrueCondition)
51
+ $validChildren = @($children | Where-Object { $_.FindFirst([TreeScope]::Element, $condition) -ne $null })
52
+
53
+ if ($includeSelf) {
54
+ $self = $element.FindFirst([TreeScope]::Element, $condition)
55
+ }
56
+
57
+ if ($null -ne $self) {
58
+ $validChildren += $self
59
+ }
60
+
61
+ foreach ($child in $children) {
62
+ $Allresults = Find-AllChildrenRecursively -element $child -condition $condition
63
+ if ($returnFirstResult -and $Allresults.Count -gt 0) {
64
+ return $Allresults
65
+ }
66
+
67
+ foreach ($result in $Allresults) {
68
+ $validChildren += ($result | Where-Object { $_.FindFirst([TreeScope]::Element, $condition) -ne $null })
69
+ }
70
+ }
71
+
72
+ return $validChildren
73
+ }
74
74
  `;
75
- exports.PAGE_SOURCE = (0, powershell_1.pwsh /* ps1 */) `
76
- function Get-PageSource {
77
- param (
78
- [Parameter(Mandatory = $true)]
79
- [AutomationElement]$element,
80
- [Xml.XmlDocument]$xmlDoc,
81
- [Xml.XmlElement]$xmlElement
82
- )
83
-
84
- try {
85
- $localizedControlType = $element.GetCurrentPropertyValue([AutomationElement]::LocalizedControlTypeProperty)
86
- $controlType = $element.GetCurrentPropertyValue([AutomationElement]::ControlTypeProperty)
87
-
88
- $tagName = ''
89
- try {
90
- $tagName = $controlType.ProgrammaticName.Split('.')[-1]
91
- if ($tagName -eq 'DataGrid') { $tagName = 'List' }
92
- elseif ($tagName -eq 'DataItem') { $tagName = 'ListItem' }
93
- } catch {
94
- # fallback to LocalizedControlType ControlType is empty
95
- $tagName = -join ($localizedControlType -split ' ' | ForEach-Object {
96
- $_.Substring(0, 1).ToUpper() + $_.Substring(1).ToLower()
97
- })
98
- }
99
-
100
- $acceleratorKey = $element.GetCurrentPropertyValue([AutomationElement]::AcceleratorKeyProperty)
101
- $accessKey = $element.GetCurrentPropertyValue([AutomationElement]::AccessKeyProperty)
102
- $automationId = $element.GetCurrentPropertyValue([AutomationElement]::AutomationIdProperty)
103
- $className = $element.GetCurrentPropertyValue([AutomationElement]::ClassNameProperty)
104
- $frameworkId = $element.GetCurrentPropertyValue([AutomationElement]::FrameworkIdProperty)
105
- $hasKeyboardfocus = $element.GetCurrentPropertyValue([AutomationElement]::HasKeyboardfocusProperty)
106
- $helpText = $element.GetCurrentPropertyValue([AutomationElement]::HelpTextProperty)
107
- $isContentelement = $element.GetCurrentPropertyValue([AutomationElement]::IsContentelementProperty)
108
- $isControlelement = $element.GetCurrentPropertyValue([AutomationElement]::IsControlelementProperty)
109
- $isEnabled = $element.GetCurrentPropertyValue([AutomationElement]::IsEnabledProperty)
110
- $isKeyboardfocusable = $element.GetCurrentPropertyValue([AutomationElement]::IsKeyboardfocusableProperty)
111
- $isOffscreen = $element.GetCurrentPropertyValue([AutomationElement]::IsOffscreenProperty)
112
- $isPassword = $element.GetCurrentPropertyValue([AutomationElement]::IsPasswordProperty)
113
- $isRequiredforform = $element.GetCurrentPropertyValue([AutomationElement]::IsRequiredforformProperty)
114
- $itemStatus = $element.GetCurrentPropertyValue([AutomationElement]::ItemStatusProperty)
115
- $itemType = $element.GetCurrentPropertyValue([AutomationElement]::ItemTypeProperty)
116
- $name = $element.GetCurrentPropertyValue([AutomationElement]::NameProperty)
117
- $orientation = $element.GetCurrentPropertyValue([AutomationElement]::OrientationProperty)
118
- $processId = $element.GetCurrentPropertyValue([AutomationElement]::ProcessIdProperty)
119
- $runtimeId = $element.GetCurrentPropertyValue([AutomationElement]::RuntimeIdProperty) -join '.'
120
- $boundingRectangle = $element.Current.BoundingRectangle
121
- $x = $boundingRectangle.X - $rootElement.Current.BoundingRectangle.X
122
- $y = $boundingRectangle.Y - $rootElement.Current.BoundingRectangle.Y
123
- $width = $boundingRectangle.Width
124
- $height = $boundingRectangle.Height
125
-
126
- if ($null -eq $xmlDoc) { $xmlDoc = [Xml.XmlDocument]::new() }
127
-
128
- $newXmlElement = $xmlDoc.CreateElement($tagName)
129
- $newXmlElement.SetAttribute("AcceleratorKey", $acceleratorKey)
130
- $newXmlElement.SetAttribute("AccessKey", $accessKey)
131
- $newXmlElement.SetAttribute("AutomationId", $automationId)
132
- $newXmlElement.SetAttribute("ClassName", $className)
133
- $newXmlElement.SetAttribute("FrameworkId", $frameworkId)
134
- $newXmlElement.SetAttribute("HasKeyboardfocus", $hasKeyboardfocus)
135
- $newXmlElement.SetAttribute("HelpText", $helpText)
136
- $newXmlElement.SetAttribute("IsContentelement", $isContentelement)
137
- $newXmlElement.SetAttribute("IsControlelement", $isControlelement)
138
- $newXmlElement.SetAttribute("IsEnabled", $isEnabled)
139
- $newXmlElement.SetAttribute("IsKeyboardfocusable", $isKeyboardfocusable)
140
- $newXmlElement.SetAttribute("IsOffscreen", $isOffscreen)
141
- $newXmlElement.SetAttribute("IsPassword", $isPassword)
142
- $newXmlElement.SetAttribute("IsRequiredforform", $isRequiredforform)
143
- $newXmlElement.SetAttribute("ItemStatus", $itemStatus)
144
- $newXmlElement.SetAttribute("ItemType", $itemType)
145
- $newXmlElement.SetAttribute("LocalizedControlType", $localizedControlType)
146
- $newXmlElement.SetAttribute("Name", $name)
147
- $newXmlElement.SetAttribute("Orientation", $orientation)
148
- $newXmlElement.SetAttribute("ProcessId", $processId)
149
- $newXmlElement.SetAttribute("RuntimeId", $runtimeId)
150
- $newXmlElement.SetAttribute("x", $x)
151
- $newXmlElement.SetAttribute("y", $y)
152
- $newXmlElement.SetAttribute("width", $width)
153
- $newXmlElement.SetAttribute("height", $height)
154
-
155
- $pattern = $null
156
-
157
- if ($element.TryGetCurrentPattern([WindowPattern]::Pattern, [ref]$pattern)) {
158
- $newXmlElement.SetAttribute("CanMaximize", $windowPattern.Current.CanMaximize)
159
- $newXmlElement.SetAttribute("CanMinimize", $windowPattern.Current.CanMinimize)
160
- $newXmlElement.SetAttribute("IsModal", $windowPattern.Current.IsModal)
161
- $newXmlElement.SetAttribute("WindowVisualState", $windowPattern.Current.WindowVisualState)
162
- $newXmlElement.SetAttribute("WindowInteractionState", $windowPattern.Current.WindowInteractionState)
163
- $newXmlElement.SetAttribute("IsTopmost", $windowPattern.Current.IsTopmost)
164
- }
165
-
166
- if ($element.TryGetCurrentPattern([TransformPattern]::Pattern, [ref]$pattern)) {
167
- $newXmlElement.SetAttribute("CanRotate", $windowPattern.Current.CanRotate)
168
- $newXmlElement.SetAttribute("CanResize", $windowPattern.Current.CanResize)
169
- $newXmlElement.SetAttribute("CanMove", $windowPattern.Current.CanMove)
170
- }
171
-
172
- # TODO: more to be added depending on the available patterns
173
-
174
- if ($null -eq $xmlElement) {
175
- $xmlElement = $xmlDoc.AppendChild($newXmlElement)
176
- } else {
177
- $xmlElement = $xmlElement.AppendChild($newXmlElement)
178
- }
179
-
180
- $elementsToProcess = New-Object System.Collections.Queue
181
- $element.FindAll([TreeScope]::Children, $cacheRequest.TreeFilter) | ForEach-Object {
182
- $elementsToProcess.Enqueue($_)
183
- }
184
-
185
- while ($elementsToProcess.Count -gt 0) {
186
- $currentElement = $elementsToProcess.Dequeue()
187
- Get-PageSource $currentElement $xmlDoc $xmlElement | Out-Null
188
- }
189
- } catch {
190
- # noop
191
- }
192
-
193
- return $xmlElement
194
- }
75
+ exports.PAGE_SOURCE = (0, powershell_1.pwsh /* ps1 */) `
76
+ function Get-PageSource {
77
+ param (
78
+ [Parameter(Mandatory = $true)]
79
+ [AutomationElement]$element,
80
+ [Xml.XmlDocument]$xmlDoc,
81
+ [Xml.XmlElement]$xmlElement
82
+ )
83
+
84
+ try {
85
+ $localizedControlType = $element.GetCurrentPropertyValue([AutomationElement]::LocalizedControlTypeProperty)
86
+ $controlType = $element.GetCurrentPropertyValue([AutomationElement]::ControlTypeProperty)
87
+
88
+ $tagName = ''
89
+ try {
90
+ $tagName = $controlType.ProgrammaticName.Split('.')[-1]
91
+ if ($tagName -eq 'DataGrid') { $tagName = 'List' }
92
+ elseif ($tagName -eq 'DataItem') { $tagName = 'ListItem' }
93
+ } catch {
94
+ # fallback to LocalizedControlType ControlType is empty
95
+ $tagName = -join ($localizedControlType -split ' ' | ForEach-Object {
96
+ $_.Substring(0, 1).ToUpper() + $_.Substring(1).ToLower()
97
+ })
98
+ }
99
+
100
+ $acceleratorKey = $element.GetCurrentPropertyValue([AutomationElement]::AcceleratorKeyProperty)
101
+ $accessKey = $element.GetCurrentPropertyValue([AutomationElement]::AccessKeyProperty)
102
+ $automationId = $element.GetCurrentPropertyValue([AutomationElement]::AutomationIdProperty)
103
+ $className = $element.GetCurrentPropertyValue([AutomationElement]::ClassNameProperty)
104
+ $frameworkId = $element.GetCurrentPropertyValue([AutomationElement]::FrameworkIdProperty)
105
+ $hasKeyboardfocus = $element.GetCurrentPropertyValue([AutomationElement]::HasKeyboardfocusProperty)
106
+ $helpText = $element.GetCurrentPropertyValue([AutomationElement]::HelpTextProperty)
107
+ $isContentelement = $element.GetCurrentPropertyValue([AutomationElement]::IsContentelementProperty)
108
+ $isControlelement = $element.GetCurrentPropertyValue([AutomationElement]::IsControlelementProperty)
109
+ $isEnabled = $element.GetCurrentPropertyValue([AutomationElement]::IsEnabledProperty)
110
+ $isKeyboardfocusable = $element.GetCurrentPropertyValue([AutomationElement]::IsKeyboardfocusableProperty)
111
+ $isOffscreen = $element.GetCurrentPropertyValue([AutomationElement]::IsOffscreenProperty)
112
+ $isPassword = $element.GetCurrentPropertyValue([AutomationElement]::IsPasswordProperty)
113
+ $isRequiredforform = $element.GetCurrentPropertyValue([AutomationElement]::IsRequiredforformProperty)
114
+ $itemStatus = $element.GetCurrentPropertyValue([AutomationElement]::ItemStatusProperty)
115
+ $itemType = $element.GetCurrentPropertyValue([AutomationElement]::ItemTypeProperty)
116
+ $name = $element.GetCurrentPropertyValue([AutomationElement]::NameProperty)
117
+ $orientation = $element.GetCurrentPropertyValue([AutomationElement]::OrientationProperty)
118
+ $processId = $element.GetCurrentPropertyValue([AutomationElement]::ProcessIdProperty)
119
+ $runtimeId = $element.GetCurrentPropertyValue([AutomationElement]::RuntimeIdProperty) -join '.'
120
+ $boundingRectangle = $element.Current.BoundingRectangle
121
+ $x = $boundingRectangle.X - $rootElement.Current.BoundingRectangle.X
122
+ $y = $boundingRectangle.Y - $rootElement.Current.BoundingRectangle.Y
123
+ $width = $boundingRectangle.Width
124
+ $height = $boundingRectangle.Height
125
+
126
+ if ($null -eq $xmlDoc) { $xmlDoc = [Xml.XmlDocument]::new() }
127
+
128
+ $newXmlElement = $xmlDoc.CreateElement($tagName)
129
+ $newXmlElement.SetAttribute("AcceleratorKey", $acceleratorKey)
130
+ $newXmlElement.SetAttribute("AccessKey", $accessKey)
131
+ $newXmlElement.SetAttribute("AutomationId", $automationId)
132
+ $newXmlElement.SetAttribute("ClassName", $className)
133
+ $newXmlElement.SetAttribute("FrameworkId", $frameworkId)
134
+ $newXmlElement.SetAttribute("HasKeyboardfocus", $hasKeyboardfocus)
135
+ $newXmlElement.SetAttribute("HelpText", $helpText)
136
+ $newXmlElement.SetAttribute("IsContentelement", $isContentelement)
137
+ $newXmlElement.SetAttribute("IsControlelement", $isControlelement)
138
+ $newXmlElement.SetAttribute("IsEnabled", $isEnabled)
139
+ $newXmlElement.SetAttribute("IsKeyboardfocusable", $isKeyboardfocusable)
140
+ $newXmlElement.SetAttribute("IsOffscreen", $isOffscreen)
141
+ $newXmlElement.SetAttribute("IsPassword", $isPassword)
142
+ $newXmlElement.SetAttribute("IsRequiredforform", $isRequiredforform)
143
+ $newXmlElement.SetAttribute("ItemStatus", $itemStatus)
144
+ $newXmlElement.SetAttribute("ItemType", $itemType)
145
+ $newXmlElement.SetAttribute("LocalizedControlType", $localizedControlType)
146
+ $newXmlElement.SetAttribute("Name", $name)
147
+ $newXmlElement.SetAttribute("Orientation", $orientation)
148
+ $newXmlElement.SetAttribute("ProcessId", $processId)
149
+ $newXmlElement.SetAttribute("RuntimeId", $runtimeId)
150
+ $newXmlElement.SetAttribute("x", $x)
151
+ $newXmlElement.SetAttribute("y", $y)
152
+ $newXmlElement.SetAttribute("width", $width)
153
+ $newXmlElement.SetAttribute("height", $height)
154
+
155
+ $pattern = $null
156
+
157
+ if ($element.TryGetCurrentPattern([WindowPattern]::Pattern, [ref]$pattern)) {
158
+ $newXmlElement.SetAttribute("CanMaximize", $windowPattern.Current.CanMaximize)
159
+ $newXmlElement.SetAttribute("CanMinimize", $windowPattern.Current.CanMinimize)
160
+ $newXmlElement.SetAttribute("IsModal", $windowPattern.Current.IsModal)
161
+ $newXmlElement.SetAttribute("WindowVisualState", $windowPattern.Current.WindowVisualState)
162
+ $newXmlElement.SetAttribute("WindowInteractionState", $windowPattern.Current.WindowInteractionState)
163
+ $newXmlElement.SetAttribute("IsTopmost", $windowPattern.Current.IsTopmost)
164
+ }
165
+
166
+ if ($element.TryGetCurrentPattern([TransformPattern]::Pattern, [ref]$pattern)) {
167
+ $newXmlElement.SetAttribute("CanRotate", $windowPattern.Current.CanRotate)
168
+ $newXmlElement.SetAttribute("CanResize", $windowPattern.Current.CanResize)
169
+ $newXmlElement.SetAttribute("CanMove", $windowPattern.Current.CanMove)
170
+ }
171
+
172
+ # TODO: more to be added depending on the available patterns
173
+
174
+ if ($null -eq $xmlElement) {
175
+ $xmlElement = $xmlDoc.AppendChild($newXmlElement)
176
+ } else {
177
+ $xmlElement = $xmlElement.AppendChild($newXmlElement)
178
+ }
179
+
180
+ $elementsToProcess = New-Object System.Collections.Queue
181
+ $element.FindAll([TreeScope]::Children, $cacheRequest.TreeFilter) | ForEach-Object {
182
+ $elementsToProcess.Enqueue($_)
183
+ }
184
+
185
+ while ($elementsToProcess.Count -gt 0) {
186
+ $currentElement = $elementsToProcess.Dequeue()
187
+ Get-PageSource $currentElement $xmlDoc $xmlElement | Out-Null
188
+ }
189
+ } catch {
190
+ # noop
191
+ }
192
+
193
+ return $xmlElement
194
+ }
195
195
  `;
196
196
  //# sourceMappingURL=functions.js.map
@@ -96,7 +96,6 @@ declare const commands: {
96
96
  setForegroundWindow(this: import("../driver").NovaWindows2Driver, args: {
97
97
  process: string;
98
98
  }): Promise<void>;
99
- getAttributes(this: import("../driver").NovaWindows2Driver, arg: any): Promise<string>;
100
99
  getProperty(this: import("../driver").NovaWindows2Driver, propertyName: string, elementId: string): Promise<string>;
101
100
  getAttribute(this: import("../driver").NovaWindows2Driver, propertyName: string, elementId: string): Promise<string>;
102
101
  active(this: import("../driver").NovaWindows2Driver): Promise<import("@appium/types").Element>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/commands/index.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAoBoxe,CAAC;;;mBAAurB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;iBAAknH,CAAC;SAAgB,CAAC;SAAgB,CAAC;cAAqB,CAAC;oBAA8B,CAAC;kBAA+G,CAAC;aAAoB,CAAC;yBAAgC,CAAC;;;sBAAgzG,CAAC;cAAqB,CAAC;cAAqB,CAAC;oBAA2B,CAAC;YAAmB,CAAC;YAAmB,CAAC;oBAA2B,CAAC;kBAA4F,CAAC;;;iBAA04H,CAAC;SAAgB,CAAC;SAAgB,CAAC;cAAqB,CAAC;cAAqB,CAAC;oBAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAVz12B,CAAC;AAEF,KAAK,QAAQ,GAAG;KACX,GAAG,IAAI,MAAM,OAAO,QAAQ,GAAG,OAAO,QAAQ,CAAC,GAAG,CAAC;CACvD,CAAC;AAEF,OAAO,QAAQ,WAAW,CAAC;IACvB,UAAU,kBAAmB,SAAQ,QAAQ;KAAI;CACpD;AAED,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/commands/index.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAoB0oW,CAAC;;;mBAAwqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;iBAAkhH,CAAC;SAAe,CAAC;SAAe,CAAC;cAAoB,CAAC;oBAA6B,CAAC;kBAA8G,CAAC;aAAmB,CAAC;yBAA+B,CAAC;;;sBAAmtG,CAAC;cAAoB,CAAC;cAAoB,CAAC;oBAA0B,CAAC;YAAkB,CAAC;YAAkB,CAAC;oBAA0B,CAAC;kBAA2F,CAAC;;;iBAA0yH,CAAC;SAAe,CAAC;SAAe,CAAC;cAAoB,CAAC;cAAoB,CAAC;oBAA0B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAVh5tB,CAAC;AAEF,KAAK,QAAQ,GAAG;KACX,GAAG,IAAI,MAAM,OAAO,QAAQ,GAAG,OAAO,QAAQ,CAAC,GAAG,CAAC;CACvD,CAAC;AAEF,OAAO,QAAQ,WAAW,CAAC;IACvB,UAAU,kBAAmB,SAAQ,QAAQ;KAAI;CACpD;AAED,eAAe,QAAQ,CAAC"}
@@ -10,75 +10,75 @@ const functions_1 = require("./functions");
10
10
  const SET_UTF8_ENCODING = /* ps1 */ `$OutputEncoding = [Console]::OutputEncoding = [Text.Encoding]::UTF8`;
11
11
  const ADD_NECESSARY_ASSEMBLIES = /* ps1 */ `Add-Type -AssemblyName UIAutomationClient; Add-Type -AssemblyName UIAutomationTypes; Add-Type -AssemblyName UIAutomationClientsideProviders; Add-Type -AssemblyName System.Drawing; Add-Type -AssemblyName PresentationCore; Add-Type -AssemblyName System.Windows.Forms`;
12
12
  const USE_UI_AUTOMATION_CLIENT = /* ps1 */ `using namespace System.Windows.Automation`;
13
- const INIT_CACHE_REQUEST = /* ps1 */ `
14
- ($cacheRequest = New-Object System.Windows.Automation.CacheRequest).TreeFilter = [AndCondition]::new([Automation]::ControlViewCondition, [NotCondition]::new([PropertyCondition]::new([AutomationElement]::FrameworkIdProperty, 'Chrome')));
15
- $cacheRequest.Add([AutomationElement]::NameProperty);
16
- $cacheRequest.Add([AutomationElement]::AutomationIdProperty);
17
- $cacheRequest.Add([AutomationElement]::ClassNameProperty);
18
- $cacheRequest.Add([AutomationElement]::ControlTypeProperty);
19
- $cacheRequest.Add([AutomationElement]::IsOffscreenProperty);
20
- $cacheRequest.Add([AutomationElement]::IsEnabledProperty);
21
- $cacheRequest.Add([AutomationElement]::BoundingRectangleProperty);
22
- $cacheRequest.Push()
13
+ const INIT_CACHE_REQUEST = /* ps1 */ `
14
+ ($cacheRequest = New-Object System.Windows.Automation.CacheRequest).TreeFilter = [AndCondition]::new([Automation]::ControlViewCondition, [NotCondition]::new([PropertyCondition]::new([AutomationElement]::FrameworkIdProperty, 'Chrome')));
15
+ $cacheRequest.Add([AutomationElement]::NameProperty);
16
+ $cacheRequest.Add([AutomationElement]::AutomationIdProperty);
17
+ $cacheRequest.Add([AutomationElement]::ClassNameProperty);
18
+ $cacheRequest.Add([AutomationElement]::ControlTypeProperty);
19
+ $cacheRequest.Add([AutomationElement]::IsOffscreenProperty);
20
+ $cacheRequest.Add([AutomationElement]::IsEnabledProperty);
21
+ $cacheRequest.Add([AutomationElement]::BoundingRectangleProperty);
22
+ $cacheRequest.Push()
23
23
  `;
24
24
  const INIT_ROOT_ELEMENT = /* ps1 */ `$rootElement = [AutomationElement]::RootElement`;
25
25
  const NULL_ROOT_ELEMENT = /* ps1 */ `$rootElement = $null`;
26
26
  const INIT_ELEMENT_TABLE = /* ps1 */ `$elementTable = New-Object System.Collections.Generic.Dictionary[[string]\`,[AutomationElement]]`;
27
- const MSAA_HELPER_CODE = /* ps1 */ `
28
- $msaaCode = @"
29
- using System;
30
- using System.Runtime.InteropServices;
31
- using System.Reflection;
32
-
33
- public static class MSAAHelper {
34
- [DllImport("oleacc.dll")]
35
- private static extern int AccessibleObjectFromWindow(IntPtr hwnd, uint dwId, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObject);
36
-
37
- public static object GetLegacyProperty(IntPtr hwnd, string propertyName) {
38
- if (hwnd == IntPtr.Zero) return null;
39
-
40
- Guid IID_IAccessible = new Guid("618736E0-3C3D-11CF-810C-00AA00389B71");
41
- object acc = null;
42
- // OBJID_CLIENT = 0xFFFFFFFC (-4)
43
- int res = AccessibleObjectFromWindow(hwnd, 0xFFFFFFFC, ref IID_IAccessible, out acc);
44
- if (res == 0 && acc != null) {
45
- try {
46
- // propertyName maps to: accName, accValue, accDescription, accRole, accState, accHelp, accKeyboardShortcut, accDefaultAction
47
- return acc.GetType().InvokeMember(propertyName,
48
- BindingFlags.GetProperty,
49
- null,
50
- acc,
51
- new object[] { 0 }); // 0 = CHILDID_SELF
52
- } catch {
53
- return null;
54
- }
55
- }
56
- return null;
57
- }
58
-
59
- public static bool SetLegacyValue(IntPtr hwnd, string value) {
60
- if (hwnd == IntPtr.Zero) return false;
61
-
62
- Guid IID_IAccessible = new Guid("618736E0-3C3D-11CF-810C-00AA00389B71");
63
- object acc = null;
64
- int res = AccessibleObjectFromWindow(hwnd, 0xFFFFFFFC, ref IID_IAccessible, out acc);
65
- if (res == 0 && acc != null) {
66
- try {
67
- acc.GetType().InvokeMember("accValue",
68
- BindingFlags.SetProperty,
69
- null,
70
- acc,
71
- new object[] { 0, value }); // 0 = CHILDID_SELF
72
- return true;
73
- } catch {
74
- return false;
75
- }
76
- }
77
- return false;
78
- }
79
- }
80
- "@
81
- Add-Type -TypeDefinition $msaaCode -Language CSharp
27
+ const MSAA_HELPER_CODE = /* ps1 */ `
28
+ $msaaCode = @"
29
+ using System;
30
+ using System.Runtime.InteropServices;
31
+ using System.Reflection;
32
+
33
+ public static class MSAAHelper {
34
+ [DllImport("oleacc.dll")]
35
+ private static extern int AccessibleObjectFromWindow(IntPtr hwnd, uint dwId, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObject);
36
+
37
+ public static object GetLegacyProperty(IntPtr hwnd, string propertyName) {
38
+ if (hwnd == IntPtr.Zero) return null;
39
+
40
+ Guid IID_IAccessible = new Guid("618736E0-3C3D-11CF-810C-00AA00389B71");
41
+ object acc = null;
42
+ // OBJID_CLIENT = 0xFFFFFFFC (-4)
43
+ int res = AccessibleObjectFromWindow(hwnd, 0xFFFFFFFC, ref IID_IAccessible, out acc);
44
+ if (res == 0 && acc != null) {
45
+ try {
46
+ // propertyName maps to: accName, accValue, accDescription, accRole, accState, accHelp, accKeyboardShortcut, accDefaultAction
47
+ return acc.GetType().InvokeMember(propertyName,
48
+ BindingFlags.GetProperty,
49
+ null,
50
+ acc,
51
+ new object[] { 0 }); // 0 = CHILDID_SELF
52
+ } catch {
53
+ return null;
54
+ }
55
+ }
56
+ return null;
57
+ }
58
+
59
+ public static bool SetLegacyValue(IntPtr hwnd, string value) {
60
+ if (hwnd == IntPtr.Zero) return false;
61
+
62
+ Guid IID_IAccessible = new Guid("618736E0-3C3D-11CF-810C-00AA00389B71");
63
+ object acc = null;
64
+ int res = AccessibleObjectFromWindow(hwnd, 0xFFFFFFFC, ref IID_IAccessible, out acc);
65
+ if (res == 0 && acc != null) {
66
+ try {
67
+ acc.GetType().InvokeMember("accValue",
68
+ BindingFlags.SetProperty,
69
+ null,
70
+ acc,
71
+ new object[] { 0, value }); // 0 = CHILDID_SELF
72
+ return true;
73
+ } catch {
74
+ return false;
75
+ }
76
+ }
77
+ return false;
78
+ }
79
+ }
80
+ "@
81
+ Add-Type -TypeDefinition $msaaCode -Language CSharp
82
82
  `;
83
83
  // Global execution chain to enforce sequential execution across all sessions
84
84
  let globalExecutionChain = Promise.resolve();
@@ -30,7 +30,6 @@ export declare class AutomationElement extends PSObject {
30
30
  findAll(scope: TreeScope, condition: Condition): AutomationElement;
31
31
  buildGetTagNameCommand(): string;
32
32
  buildGetPropertyCommand(property: string): string;
33
- buildGetAllPropertiesCommand(): string;
34
33
  buildGetElementRectCommand(): string;
35
34
  buildSetFocusCommand(): string;
36
35
  buildCommand(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../lib/powershell/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAS,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAw2BzC,eAAO,MAAM,SAAS;;;;;;;;;;;;;EAaX,CAAC;AAEZ,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE/C,eAAO,MAAM,qBAAqB;;;EAGv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