uia 0.0.7.1 → 0.0.7.2
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.
- data/ChangeLog +4 -0
- data/ext/UiaDll/UIA.Helper/Element.cs +4 -4
- data/ext/UiaDll/UiaDll/ElementMethods.cpp +6 -4
- data/lib/uia/element.rb +4 -2
- data/lib/uia/library.rb +2 -2
- data/lib/uia/version.rb +1 -1
- data/spec/uia/element_spec.rb +4 -0
- metadata +3 -3
data/ChangeLog
CHANGED
@@ -97,9 +97,9 @@ namespace UIA.Helper
|
|
97
97
|
return FindFirst(automationId.IdCondition());
|
98
98
|
}
|
99
99
|
|
100
|
-
public Element ChildById(string automationId)
|
100
|
+
public Element ChildById(string automationId, TreeScope scope)
|
101
101
|
{
|
102
|
-
return FindFirst(
|
102
|
+
return FindFirst(scope, automationId.IdCondition());
|
103
103
|
}
|
104
104
|
|
105
105
|
public static Element ByName(string name)
|
@@ -107,9 +107,9 @@ namespace UIA.Helper
|
|
107
107
|
return FindFirst(new PropertyCondition(AutomationElement.NameProperty, name));
|
108
108
|
}
|
109
109
|
|
110
|
-
public Element ChildByName(string name)
|
110
|
+
public Element ChildByName(string name, TreeScope scope)
|
111
111
|
{
|
112
|
-
return FindFirst(
|
112
|
+
return FindFirst(scope, new PropertyCondition(AutomationElement.NameProperty, name));
|
113
113
|
}
|
114
114
|
|
115
115
|
public static Element ByProcessId(int processId)
|
@@ -37,9 +37,10 @@ extern "C" {
|
|
37
37
|
return NULL;
|
38
38
|
}
|
39
39
|
|
40
|
-
__declspec(dllexport) ElementInformationPtr Element_FindChildById(ElementInformationPtr parent, const char* automationId, char* errorInfo, const int errorLength) {
|
40
|
+
__declspec(dllexport) ElementInformationPtr Element_FindChildById(ElementInformationPtr parent, const char* automationId, const char* treeScope, char* errorInfo, const int errorLength) {
|
41
41
|
try {
|
42
|
-
|
42
|
+
auto scope = (TreeScope) Enum::Parse(TreeScope::typeid, gcnew String(treeScope));
|
43
|
+
return ElementInformation::From(Find(parent)->ChildById(gcnew String(automationId), scope));
|
43
44
|
} catch(Exception^ error) {
|
44
45
|
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
45
46
|
}
|
@@ -57,9 +58,10 @@ extern "C" {
|
|
57
58
|
return NULL;
|
58
59
|
}
|
59
60
|
|
60
|
-
__declspec(dllexport) ElementInformationPtr Element_FindChildByName(ElementInformationPtr parent, const char* name, char* errorInfo, const int errorLength) {
|
61
|
+
__declspec(dllexport) ElementInformationPtr Element_FindChildByName(ElementInformationPtr parent, const char* name, const char* treeScope, char* errorInfo, const int errorLength) {
|
61
62
|
try {
|
62
|
-
|
63
|
+
auto scope = (TreeScope) Enum::Parse(TreeScope::typeid, gcnew String(treeScope));
|
64
|
+
return ElementInformation::From(Find(parent)->ChildByName(gcnew String(name), scope));
|
63
65
|
} catch(Exception^ error) {
|
64
66
|
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
65
67
|
}
|
data/lib/uia/element.rb
CHANGED
@@ -27,11 +27,13 @@ module Uia
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def find(locator)
|
30
|
+
scope = (locator[:scope] || :descendants).to_s.capitalize
|
31
|
+
|
30
32
|
case
|
31
33
|
when locator[:id]
|
32
|
-
Library::find_child_by_id(@element, locator[:id])
|
34
|
+
Library::find_child_by_id(@element, locator[:id], scope)
|
33
35
|
when locator[:name]
|
34
|
-
Library::find_child_by_name(@element, locator[:name])
|
36
|
+
Library::find_child_by_name(@element, locator[:name], scope)
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
data/lib/uia/library.rb
CHANGED
@@ -61,8 +61,8 @@ module Uia
|
|
61
61
|
attach_function :Element_FindByRuntimeId, [:pointer, :int, :pointer, :int], ManagedElementStruct.by_ref
|
62
62
|
|
63
63
|
# element methods
|
64
|
-
attach_throwable_function :find_child_by_id, :Element_FindChildById, [:pointer, :string], ManagedElementStruct.by_ref, &element_or_nil
|
65
|
-
attach_throwable_function :find_child_by_name, :Element_FindChildByName, [:pointer, :string], ManagedElementStruct.by_ref, &element_or_nil
|
64
|
+
attach_throwable_function :find_child_by_id, :Element_FindChildById, [:pointer, :string, :string], ManagedElementStruct.by_ref, &element_or_nil
|
65
|
+
attach_throwable_function :find_child_by_name, :Element_FindChildByName, [:pointer, :string, :string], ManagedElementStruct.by_ref, &element_or_nil
|
66
66
|
elements_from :children, :Element_Children, [:pointer]
|
67
67
|
elements_from :descendants, :Element_Descendants, [:pointer]
|
68
68
|
attach_throwable_function :click, :Element_Click, [:pointer], :void
|
data/lib/uia/version.rb
CHANGED
data/spec/uia/element_spec.rb
CHANGED
@@ -58,6 +58,10 @@ describe Uia::Element do
|
|
58
58
|
Then { element.find(name: 'No option selected') != nil }
|
59
59
|
Then { element.find(name: 'does not exist') == nil }
|
60
60
|
end
|
61
|
+
|
62
|
+
context 'limiting scope' do
|
63
|
+
Then { element.find(name: 'label2', scope: :children) == nil }
|
64
|
+
end
|
61
65
|
end
|
62
66
|
|
63
67
|
context '#select' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.7.
|
4
|
+
version: 0.0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -239,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
239
|
version: '0'
|
240
240
|
segments:
|
241
241
|
- 0
|
242
|
-
hash:
|
242
|
+
hash: -527449199
|
243
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
244
|
none: false
|
245
245
|
requirements:
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
version: '0'
|
249
249
|
segments:
|
250
250
|
- 0
|
251
|
-
hash:
|
251
|
+
hash: -527449199
|
252
252
|
requirements: []
|
253
253
|
rubyforge_project:
|
254
254
|
rubygems_version: 1.8.24
|