uia 0.0.6 → 0.0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/ext/UiaDll/Release/UIA.Helper.dll +0 -0
- data/ext/UiaDll/Release/UiaDll.dll +0 -0
- data/ext/UiaDll/UIA.Helper/Element.cs +11 -1
- data/ext/UiaDll/UiaDll/ElementMethods.cpp +1 -1
- data/lib/uia/element.rb +2 -2
- data/lib/uia/library/structs.rb +2 -1
- data/lib/uia/library.rb +1 -3
- data/lib/uia/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/uia_spec.rb +7 -7
- metadata +4 -4
data/ChangeLog
CHANGED
Binary file
|
Binary file
|
@@ -62,6 +62,11 @@ namespace UIA.Helper
|
|
62
62
|
get { return _element.GetSupportedPatterns().Select(x => x.Id).ToArray(); }
|
63
63
|
}
|
64
64
|
|
65
|
+
public static Element[] Windows
|
66
|
+
{
|
67
|
+
get { return Find(AutomationElement.RootElement, TreeScope.Children, Condition.TrueCondition); }
|
68
|
+
}
|
69
|
+
|
65
70
|
public Element[] Children
|
66
71
|
{
|
67
72
|
get { return Find(TreeScope.Children, Condition.TrueCondition); }
|
@@ -124,7 +129,12 @@ namespace UIA.Helper
|
|
124
129
|
|
125
130
|
private Element[] Find(TreeScope scope, Condition condition)
|
126
131
|
{
|
127
|
-
return _element
|
132
|
+
return Find(_element, scope, condition);
|
133
|
+
}
|
134
|
+
|
135
|
+
private static Element[] Find(AutomationElement element, TreeScope scope, Condition condition)
|
136
|
+
{
|
137
|
+
return element.FindAll(scope, condition).Cast<AutomationElement>()
|
128
138
|
.Select(x => new Element(x))
|
129
139
|
.ToArray();
|
130
140
|
}
|
@@ -99,7 +99,7 @@ extern "C" {
|
|
99
99
|
|
100
100
|
__declspec(dllexport) ElementsPtr Root_Children(char* errorInfo, const int errorInfoLength) {
|
101
101
|
try {
|
102
|
-
return new Elements(Element::
|
102
|
+
return new Elements(Element::Windows);
|
103
103
|
} catch(Exception^ e) {
|
104
104
|
StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
|
105
105
|
return NULL;
|
data/lib/uia/element.rb
CHANGED
data/lib/uia/library/structs.rb
CHANGED
data/lib/uia/library.rb
CHANGED
@@ -5,8 +5,6 @@ module Uia
|
|
5
5
|
module Library
|
6
6
|
extend FFI::Library
|
7
7
|
|
8
|
-
PropertyId = enum(:is_selection_item, 0)
|
9
|
-
|
10
8
|
def self.uia_directory
|
11
9
|
File.dirname(__FILE__) + '/../../ext/UiaDll/Release'
|
12
10
|
end
|
@@ -45,7 +43,7 @@ module Uia
|
|
45
43
|
attach_throwable_function :find_by_id, :Element_FindById, [:string], ElementStruct.by_ref, &element_or_nil
|
46
44
|
attach_throwable_function :find_by_name, :Element_FindByName, [:string], ElementStruct.by_ref, &element_or_nil
|
47
45
|
attach_throwable_function :find_by_pid, :Element_FindByProcessId, [:int], ElementStruct.by_ref, &element_or_nil
|
48
|
-
attach_throwable_function :find_by_handle, :Element_FindByHandle, [:int], ElementStruct.by_ref
|
46
|
+
attach_throwable_function :find_by_handle, :Element_FindByHandle, [:int], ElementStruct.by_ref, &element_or_nil
|
49
47
|
attach_function :Element_FindByRuntimeId, [:pointer, :int, :pointer, :int], ElementStruct.by_ref
|
50
48
|
|
51
49
|
# element methods
|
data/lib/uia/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/uia_spec.rb
CHANGED
@@ -9,24 +9,24 @@ describe Uia do
|
|
9
9
|
Given(:main_window) { Uia.find_element id: 'MainFormWindow' }
|
10
10
|
|
11
11
|
context 'by id' do
|
12
|
-
Then { Uia.find_element(id: 'MainFormWindow')
|
13
|
-
Then { Uia.find_element(id: /[Mm]ain/)
|
12
|
+
Then { expect(Uia.find_element(id: 'MainFormWindow')).to be_instance_of(Element) }
|
13
|
+
Then { expect(Uia.find_element(id: /[Mm]ain/)).to be_instance_of(Element) }
|
14
14
|
Then { Uia.find_element(id: 'not there') == nil }
|
15
15
|
end
|
16
16
|
|
17
17
|
context 'by name' do
|
18
|
-
Then { Uia.find_element(name: 'MainFormWindow')
|
19
|
-
Then { Uia.find_element(name: /[Mm]ain.*Window/ )
|
18
|
+
Then { expect(Uia.find_element(name: 'MainFormWindow')).to be_instance_of(Element) }
|
19
|
+
Then { expect(Uia.find_element(name: /[Mm]ain.*Window/ )).to be_instance_of(Element) }
|
20
20
|
Then { Uia.find_element(name: 'not there') == nil }
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'by process id' do
|
24
|
-
Then { Uia.find_element(pid: @app.pid)
|
24
|
+
Then { expect(Uia.find_element(pid: @app.pid)).to be_instance_of(Element) }
|
25
25
|
Then { Uia.find_element(pid: -1) == nil }
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'by runtime id' do
|
29
|
-
Then { Uia.find_element(runtime_id: main_window.runtime_id)
|
29
|
+
Then { expect(Uia.find_element(runtime_id: main_window.runtime_id)).to be_instance_of(Element) }
|
30
30
|
|
31
31
|
context 'can search descendants' do
|
32
32
|
Given(:element_with_no_handle) { Uia.find_element(id: 'MainFormWindow').find(name: 'Parent Two') }
|
@@ -35,7 +35,7 @@ describe Uia do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'by window handle' do
|
38
|
-
Then { Uia.find_element(handle: main_window.handle)
|
38
|
+
Then { expect(Uia.find_element(handle: main_window.handle)).to be_instance_of(Element) }
|
39
39
|
Then { expect { Uia.find_element(handle: 0x0) }.to raise_error }
|
40
40
|
end
|
41
41
|
|
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.6
|
4
|
+
version: 0.0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -211,7 +211,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
211
211
|
version: '0'
|
212
212
|
segments:
|
213
213
|
- 0
|
214
|
-
hash:
|
214
|
+
hash: 849394065
|
215
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
216
|
none: false
|
217
217
|
requirements:
|
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
220
|
version: '0'
|
221
221
|
segments:
|
222
222
|
- 0
|
223
|
-
hash:
|
223
|
+
hash: 849394065
|
224
224
|
requirements: []
|
225
225
|
rubyforge_project:
|
226
226
|
rubygems_version: 1.8.24
|