rautomation 0.8.0 → 0.9.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.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -3
- data/History.rdoc +17 -0
- data/README.rdoc +2 -1
- data/Rakefile +23 -6
- data/VERSION +1 -1
- data/ext/IAccessibleDLL/Release/IAccessibleDLL.dll +0 -0
- data/ext/UiaDll/Release/UiaDll.dll +0 -0
- data/ext/UiaDll/UiaDll/{AutomatedComboBox.cpp → AutomatedSelectList.cpp} +22 -11
- data/ext/UiaDll/UiaDll/{AutomatedComboBox.h → AutomatedSelectList.h} +17 -4
- data/ext/UiaDll/UiaDll/AutomatedTable.cpp +55 -13
- data/ext/UiaDll/UiaDll/AutomatedTable.h +16 -3
- data/ext/UiaDll/UiaDll/AutomationControl.cpp +28 -0
- data/ext/UiaDll/UiaDll/AutomationControl.h +56 -0
- data/ext/UiaDll/UiaDll/AutomationFinder.cpp +57 -0
- data/ext/UiaDll/UiaDll/AutomationFinder.h +48 -0
- data/ext/UiaDll/UiaDll/ControlMethods.cpp +15 -0
- data/ext/UiaDll/UiaDll/MenuItemSelector.h +2 -0
- data/ext/UiaDll/UiaDll/MenuMethods.cpp +58 -0
- data/ext/UiaDll/UiaDll/SelectListMethods.cpp +37 -0
- data/ext/UiaDll/UiaDll/SelectionItem.cpp +10 -0
- data/ext/UiaDll/UiaDll/SelectionItem.h +21 -0
- data/ext/UiaDll/UiaDll/StringHelper.cpp +33 -2
- data/ext/UiaDll/UiaDll/StringHelper.h +6 -0
- data/ext/UiaDll/UiaDll/StringMethods.cpp +8 -0
- data/ext/UiaDll/UiaDll/TableMethods.cpp +76 -0
- data/ext/UiaDll/UiaDll/Toggle.cpp +2 -0
- data/ext/UiaDll/UiaDll/Toggle.h +22 -0
- data/ext/UiaDll/UiaDll/UiaDll.cpp +96 -327
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +15 -4
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +91 -22
- data/ext/UiaDll/UiaDll/dllmain.cpp +1 -1
- data/ext/UiaDll/UiaDll/stdafx.h +38 -21
- data/ext/WindowsForms/Release/WindowsForms.exe +0 -0
- data/ext/WindowsForms/WindowsForms.sln +10 -0
- data/ext/WindowsForms/WindowsForms/AutomatableMonthCalendar.cs +59 -0
- data/ext/WindowsForms/WindowsForms/AutomationHelpers/AutomationProvider.cs +91 -0
- data/ext/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +32 -10
- data/ext/WindowsForms/WindowsForms/MainFormWindow.cs +10 -0
- data/ext/WindowsForms/WindowsForms/WindowsForms.csproj +15 -6
- data/lib/rautomation/adapter/ms_uia.rb +1 -0
- data/lib/rautomation/adapter/ms_uia/checkbox.rb +2 -10
- data/lib/rautomation/adapter/ms_uia/constants.rb +1 -0
- data/lib/rautomation/adapter/ms_uia/control.rb +14 -67
- data/lib/rautomation/adapter/ms_uia/functions.rb +2 -18
- data/lib/rautomation/adapter/ms_uia/list_box.rb +5 -27
- data/lib/rautomation/adapter/ms_uia/list_item.rb +2 -29
- data/lib/rautomation/adapter/ms_uia/radio.rb +1 -1
- data/lib/rautomation/adapter/ms_uia/select_list.rb +5 -6
- data/lib/rautomation/adapter/ms_uia/table.rb +15 -50
- data/lib/rautomation/adapter/ms_uia/text_field.rb +1 -1
- data/lib/rautomation/adapter/ms_uia/uia_dll.rb +226 -58
- data/lib/rautomation/adapter/ms_uia/value_control.rb +21 -0
- data/lib/rautomation/adapter/ms_uia/window.rb +6 -104
- data/lib/rautomation/adapter/win_32/functions.rb +0 -23
- data/lib/rautomation/adapter/win_32/keys.rb +64 -61
- data/rautomation.gemspec +6 -1
- data/spec/adapter/autoit/mouse_spec.rb +1 -1
- data/spec/adapter/ms_uia/select_list_spec.rb +0 -21
- data/spec/adapter/ms_uia/table_spec.rb +13 -11
- data/spec/adapter/ms_uia/text_field_spec.rb +15 -8
- data/spec/adapter/ms_uia/value_control_spec.rb +11 -0
- data/spec/adapter/ms_uia/window_spec.rb +7 -1
- data/spec/adapter/win_32/mouse_spec.rb +1 -1
- data/spec/adapter/win_32/text_field_spec.rb +5 -5
- data/spec/adapter/win_32/window_spec.rb +1 -1
- data/spec/text_field_spec.rb +18 -23
- data/spec/window_spec.rb +1 -3
- metadata +45 -34
- data/ext/UiaDll/UiaDll/ToggleStateHelper.cpp +0 -33
@@ -67,6 +67,8 @@
|
|
67
67
|
this.toToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
68
68
|
this.aboutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
69
69
|
this.treeView = new System.Windows.Forms.TreeView();
|
70
|
+
this.multiLineTextField = new System.Windows.Forms.TextBox();
|
71
|
+
this.automatableMonthCalendar1 = new WindowsForms.AutomatableMonthCalendar();
|
70
72
|
this.groupBox1.SuspendLayout();
|
71
73
|
this.groupBox2.SuspendLayout();
|
72
74
|
this.menuStrip1.SuspendLayout();
|
@@ -341,7 +343,7 @@
|
|
341
343
|
this.faileToolStripMenuItem});
|
342
344
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
343
345
|
this.menuStrip1.Name = "menuStrip1";
|
344
|
-
this.menuStrip1.Size = new System.Drawing.Size(
|
346
|
+
this.menuStrip1.Size = new System.Drawing.Size(657, 24);
|
345
347
|
this.menuStrip1.TabIndex = 15;
|
346
348
|
this.menuStrip1.Text = "menuStrip1";
|
347
349
|
//
|
@@ -404,11 +406,29 @@
|
|
404
406
|
this.treeView.Size = new System.Drawing.Size(159, 177);
|
405
407
|
this.treeView.TabIndex = 16;
|
406
408
|
//
|
409
|
+
// multiLineTextField
|
410
|
+
//
|
411
|
+
this.multiLineTextField.Location = new System.Drawing.Point(142, 339);
|
412
|
+
this.multiLineTextField.Multiline = true;
|
413
|
+
this.multiLineTextField.Name = "multiLineTextField";
|
414
|
+
this.multiLineTextField.Size = new System.Drawing.Size(325, 123);
|
415
|
+
this.multiLineTextField.TabIndex = 5;
|
416
|
+
//
|
417
|
+
// automatableMonthCalendar1
|
418
|
+
//
|
419
|
+
this.automatableMonthCalendar1.Location = new System.Drawing.Point(142, 474);
|
420
|
+
this.automatableMonthCalendar1.MaxSelectionCount = 1;
|
421
|
+
this.automatableMonthCalendar1.Name = "automatableMonthCalendar1";
|
422
|
+
this.automatableMonthCalendar1.TabIndex = 17;
|
423
|
+
this.automatableMonthCalendar1.DateChanged += new System.Windows.Forms.DateRangeEventHandler(this.automatableMonthCalendar1_DateChanged);
|
424
|
+
//
|
407
425
|
// MainFormWindow
|
408
426
|
//
|
409
427
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
410
428
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
411
|
-
this.ClientSize = new System.Drawing.Size(
|
429
|
+
this.ClientSize = new System.Drawing.Size(657, 657);
|
430
|
+
this.Controls.Add(this.automatableMonthCalendar1);
|
431
|
+
this.Controls.Add(this.multiLineTextField);
|
412
432
|
this.Controls.Add(this.treeView);
|
413
433
|
this.Controls.Add(this.FruitListBox);
|
414
434
|
this.Controls.Add(this.textBoxDisabled);
|
@@ -466,14 +486,16 @@
|
|
466
486
|
private System.Windows.Forms.RadioButton radioButtonDisabled;
|
467
487
|
private System.Windows.Forms.TextBox textBoxDisabled;
|
468
488
|
private System.Windows.Forms.ComboBox comboBoxDisabled;
|
469
|
-
private System.Windows.Forms.ListBox FruitListBox;
|
470
|
-
private System.Windows.Forms.MenuStrip menuStrip1;
|
471
|
-
private System.Windows.Forms.ToolStripMenuItem faileToolStripMenuItem;
|
472
|
-
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
473
|
-
private System.Windows.Forms.ToolStripMenuItem roundaboutWayToolStripMenuItem;
|
474
|
-
private System.Windows.Forms.ToolStripMenuItem toToolStripMenuItem;
|
475
|
-
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem1;
|
476
|
-
private System.Windows.Forms.TreeView treeView;
|
489
|
+
private System.Windows.Forms.ListBox FruitListBox;
|
490
|
+
private System.Windows.Forms.MenuStrip menuStrip1;
|
491
|
+
private System.Windows.Forms.ToolStripMenuItem faileToolStripMenuItem;
|
492
|
+
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
493
|
+
private System.Windows.Forms.ToolStripMenuItem roundaboutWayToolStripMenuItem;
|
494
|
+
private System.Windows.Forms.ToolStripMenuItem toToolStripMenuItem;
|
495
|
+
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem1;
|
496
|
+
private System.Windows.Forms.TreeView treeView;
|
497
|
+
private System.Windows.Forms.TextBox multiLineTextField;
|
498
|
+
private AutomatableMonthCalendar automatableMonthCalendar1;
|
477
499
|
}
|
478
500
|
}
|
479
501
|
|
@@ -73,5 +73,15 @@ namespace WindowsForms
|
|
73
73
|
SimpleElementsForm buttonForm = new SimpleElementsForm();
|
74
74
|
buttonForm.Show();
|
75
75
|
}
|
76
|
+
|
77
|
+
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
|
78
|
+
{
|
79
|
+
|
80
|
+
}
|
81
|
+
|
82
|
+
private void automatableMonthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
|
83
|
+
{
|
84
|
+
|
85
|
+
}
|
76
86
|
}
|
77
87
|
}
|
@@ -44,6 +44,10 @@
|
|
44
44
|
<Reference Include="System.Drawing" />
|
45
45
|
<Reference Include="System.Windows.Forms" />
|
46
46
|
<Reference Include="System.Xml" />
|
47
|
+
<Reference Include="UIAutomationClient" />
|
48
|
+
<Reference Include="UIAutomationProvider" />
|
49
|
+
<Reference Include="UIAutomationTypes" />
|
50
|
+
<Reference Include="WindowsBase" />
|
47
51
|
</ItemGroup>
|
48
52
|
<ItemGroup>
|
49
53
|
<Compile Include="AboutBox.cs">
|
@@ -52,6 +56,10 @@
|
|
52
56
|
<Compile Include="AboutBox.Designer.cs">
|
53
57
|
<DependentUpon>AboutBox.cs</DependentUpon>
|
54
58
|
</Compile>
|
59
|
+
<Compile Include="AutomatableMonthCalendar.cs">
|
60
|
+
<SubType>Component</SubType>
|
61
|
+
</Compile>
|
62
|
+
<Compile Include="AutomationHelpers\AutomationProvider.cs" />
|
55
63
|
<Compile Include="DataEntryForm.cs">
|
56
64
|
<SubType>Form</SubType>
|
57
65
|
</Compile>
|
@@ -112,12 +120,13 @@
|
|
112
120
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
113
121
|
</Compile>
|
114
122
|
</ItemGroup>
|
123
|
+
<ItemGroup />
|
115
124
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
116
|
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
117
|
-
Other similar extension points exist, see Microsoft.Common.targets.
|
118
|
-
<Target Name="BeforeBuild">
|
119
|
-
</Target>
|
120
|
-
<Target Name="AfterBuild">
|
121
|
-
</Target>
|
125
|
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
126
|
+
Other similar extension points exist, see Microsoft.Common.targets.
|
127
|
+
<Target Name="BeforeBuild">
|
128
|
+
</Target>
|
129
|
+
<Target Name="AfterBuild">
|
130
|
+
</Target>
|
122
131
|
-->
|
123
132
|
</Project>
|
@@ -12,6 +12,7 @@ require File.dirname(__FILE__) + "/ms_uia/locators"
|
|
12
12
|
require File.dirname(__FILE__) + "/ms_uia/window"
|
13
13
|
require File.dirname(__FILE__) + "/ms_uia/button_helper"
|
14
14
|
require File.dirname(__FILE__) + "/ms_uia/control"
|
15
|
+
require File.dirname(__FILE__) + "/ms_uia/value_control"
|
15
16
|
require File.dirname(__FILE__) + "/ms_uia/button"
|
16
17
|
require File.dirname(__FILE__) + "/ms_uia/checkbox"
|
17
18
|
require File.dirname(__FILE__) + "/ms_uia/menu"
|
@@ -6,24 +6,16 @@ module RAutomation
|
|
6
6
|
include Locators
|
7
7
|
include ButtonHelper
|
8
8
|
|
9
|
-
def value
|
10
|
-
checkbox = uia_element
|
11
|
-
|
12
|
-
checkbox_value = FFI::MemoryPointer.new :char, UiaDll::get_name(checkbox, nil) + 1
|
13
|
-
UiaDll::get_name(checkbox, checkbox_value)
|
14
|
-
|
15
|
-
checkbox_value.read_string
|
16
|
-
end
|
17
|
-
|
18
9
|
def exist?
|
19
10
|
super && matches_type?(Constants::UIA_CHECKBOX_CONTROL_TYPE)
|
20
11
|
end
|
21
12
|
|
22
13
|
def set?
|
23
|
-
UiaDll::
|
14
|
+
UiaDll::is_set(search_information)
|
24
15
|
end
|
25
16
|
|
26
17
|
alias_method :exists?, :exist?
|
18
|
+
alias_method :value, :control_name
|
27
19
|
|
28
20
|
end
|
29
21
|
end
|
@@ -99,6 +99,7 @@ module RAutomation
|
|
99
99
|
UIA_RADIO_BUTTON_CONTROL_TYPE = 50013
|
100
100
|
UIA_COMBOBOX_CONTROL_TYPE = 50003
|
101
101
|
UIA_EDIT_CONTROL_TYPE = 50004
|
102
|
+
UIA_DOCUMENT_CONTROL_TYPE = 50030
|
102
103
|
UIA_HEADER_CONTROL_TYPE = 50034
|
103
104
|
UIA_HEADER_ITEM_CONTROL_TYPE = 50035
|
104
105
|
UIA_WINDOW_CONTROL_TYPE = 50032
|
@@ -24,55 +24,15 @@ module RAutomation
|
|
24
24
|
Functions.control_hwnd(@window.hwnd, @locators)
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# when @locators[:value]
|
33
|
-
# uia_window = UiaDll::element_from_handle(@window.hwnd)
|
34
|
-
# begin
|
35
|
-
# uia_window.read_pointer
|
36
|
-
# rescue FFI::NullPointerError => e
|
37
|
-
# raise UnknownElementException, "Window with handle #{@window.hwnd} does not exist"
|
38
|
-
# end
|
39
|
-
# uia_control = UiaDll::find_child_by_name(uia_window, @locators[:value].to_s)
|
40
|
-
# begin
|
41
|
-
# uia_control.read_pointer
|
42
|
-
# rescue FFI::NullPointerError => e
|
43
|
-
# raise UnknownElementException, "#{@locators[:value]} does not exist"
|
44
|
-
# end
|
45
|
-
when @locators[:focus]
|
46
|
-
uia_control = UiaDll::get_focused_element
|
47
|
-
begin
|
48
|
-
uia_control.read_pointer
|
49
|
-
rescue FFI::NullPointerError => e
|
50
|
-
raise UnknownElementException, "Focused element does not exist"
|
51
|
-
end
|
52
|
-
when @locators[:id]
|
53
|
-
uia_window = UiaDll::element_from_handle(@window.hwnd)
|
54
|
-
uia_control = UiaDll::find_child_by_id(uia_window, @locators[:id].to_s)
|
55
|
-
begin
|
56
|
-
uia_control.read_pointer
|
57
|
-
rescue FFI::NullPointerError => e
|
58
|
-
raise UnknownElementException, "#{@locators[:id]} does not exist"
|
59
|
-
end
|
60
|
-
when @locators[:point]
|
61
|
-
uia_control = UiaDll::element_from_point(@locators[:point][0], @locators[:point][1])
|
62
|
-
begin
|
63
|
-
uia_control.read_pointer
|
64
|
-
rescue FFI::NullPointerError => e
|
65
|
-
raise UnknownElementException, "#{@locators[:point]} does not exist"
|
66
|
-
end
|
67
|
-
else
|
68
|
-
handle= hwnd
|
69
|
-
raise UnknownElementException, "Element with #{@locators.inspect} does not exist" if (handle == 0) or (handle == nil)
|
70
|
-
uia_control = UiaDll::element_from_handle(handle)
|
27
|
+
def search_information
|
28
|
+
info = UiaDll::SearchCriteria.from_locator(@window.hwnd, @locators)
|
29
|
+
if info.how == 0
|
30
|
+
info.how = :hwnd
|
31
|
+
info.data = hwnd
|
71
32
|
end
|
72
|
-
|
33
|
+
info
|
73
34
|
end
|
74
35
|
|
75
|
-
|
76
36
|
#todo - replace with UIA version
|
77
37
|
def click
|
78
38
|
assert_enabled
|
@@ -90,7 +50,7 @@ module RAutomation
|
|
90
50
|
|
91
51
|
def exist?
|
92
52
|
begin
|
93
|
-
!!
|
53
|
+
UiaDll::exists?(search_information) || !!hwnd
|
94
54
|
rescue UnknownElementException
|
95
55
|
false
|
96
56
|
end
|
@@ -117,12 +77,7 @@ module RAutomation
|
|
117
77
|
end
|
118
78
|
|
119
79
|
def bounding_rectangle
|
120
|
-
|
121
|
-
|
122
|
-
boundary = FFI::MemoryPointer.new :long, 4
|
123
|
-
UiaDll::bounding_rectangle(control, boundary)
|
124
|
-
|
125
|
-
boundary.read_array_of_long(4)
|
80
|
+
UiaDll::bounding_rectangle(search_information)
|
126
81
|
end
|
127
82
|
|
128
83
|
def visible?
|
@@ -141,32 +96,24 @@ module RAutomation
|
|
141
96
|
false
|
142
97
|
end
|
143
98
|
|
144
|
-
def matches_type?(
|
145
|
-
get_current_control_type
|
99
|
+
def matches_type?(*classes)
|
100
|
+
classes.include? get_current_control_type
|
146
101
|
end
|
147
102
|
|
148
103
|
def get_current_control_type
|
149
|
-
UiaDll::current_control_type(
|
104
|
+
UiaDll::current_control_type(search_information)
|
150
105
|
end
|
151
106
|
|
152
107
|
def new_pid
|
153
|
-
UiaDll::
|
108
|
+
UiaDll::process_id(search_information)
|
154
109
|
end
|
155
110
|
|
156
111
|
def control_name
|
157
|
-
|
158
|
-
element_name = FFI::MemoryPointer.new :char, UiaDll::get_name(uia_control, nil) + 1
|
159
|
-
|
160
|
-
UiaDll::get_name(uia_control, element_name)
|
161
|
-
element_name.read_string
|
112
|
+
UiaDll::name(search_information)
|
162
113
|
end
|
163
114
|
|
164
115
|
def control_class
|
165
|
-
|
166
|
-
element_class = FFI::MemoryPointer.new :char, UiaDll::get_class_name(uia_control, nil) + 1
|
167
|
-
|
168
|
-
UiaDll::get_class_name(uia_control, element_class)
|
169
|
-
element_class.read_string
|
116
|
+
UiaDll::class_name(search_information)
|
170
117
|
end
|
171
118
|
|
172
119
|
alias_method :exists?, :exist?
|
@@ -8,7 +8,6 @@ module RAutomation
|
|
8
8
|
module Functions
|
9
9
|
extend FFI::Library
|
10
10
|
|
11
|
-
# TODO once done adapt the path to the DLL (somewhere in the packaged gem)
|
12
11
|
ffi_lib 'user32', 'kernel32', 'ole32', File.dirname(__FILE__) + '/../../../../ext/IAccessibleDLL/Release/iaccessibleDll.dll'
|
13
12
|
ffi_convention :stdcall
|
14
13
|
|
@@ -85,8 +84,6 @@ module RAutomation
|
|
85
84
|
[:long, :long, :pointer, :long, :pointer], :void
|
86
85
|
attach_function :select_table_row, :select_table_row,
|
87
86
|
[:long, :long, :long], :void
|
88
|
-
attach_function :get_table_row_state, :get_table_row_state,
|
89
|
-
[:long, :long, :long], :long
|
90
87
|
|
91
88
|
class << self
|
92
89
|
|
@@ -230,32 +227,19 @@ module RAutomation
|
|
230
227
|
def retrieve_combobox_item_text(control_hwnd, item_no)
|
231
228
|
text_len = 1024
|
232
229
|
string_buffer = FFI::MemoryPointer.new :char, text_len
|
233
|
-
UiaDll::
|
230
|
+
UiaDll::select_list_value_at control_hwnd, item_no, string_buffer, text_len
|
234
231
|
string_buffer.read_string
|
235
232
|
end
|
236
233
|
|
237
234
|
def control_name(control_hwnd)
|
238
235
|
string_buffer = FFI::MemoryPointer.new :char, 255
|
239
|
-
if (get_control_name(control_hwnd, string_buffer
|
236
|
+
if (UiaDll::get_control_name(control_hwnd, string_buffer, 255))
|
240
237
|
string_buffer.read_string
|
241
238
|
else
|
242
239
|
fail "Cannot get name for control with HWND 0x" + control_hwnd.to_s(16)
|
243
240
|
end
|
244
241
|
end
|
245
242
|
|
246
|
-
def retrieve_table_strings_for_row(control_hwnd, row)
|
247
|
-
hModule = load_library("oleacc.dll") # TODO should be done only one time
|
248
|
-
|
249
|
-
strings_ptr = FFI::MemoryPointer.new :pointer
|
250
|
-
columns_ptr = FFI::MemoryPointer.new :pointer
|
251
|
-
|
252
|
-
get_table_row_strings(hModule, control_hwnd, strings_ptr, row, columns_ptr)
|
253
|
-
str_ptr = strings_ptr.read_pointer
|
254
|
-
columns = columns_ptr.read_long
|
255
|
-
|
256
|
-
str_ptr.get_array_of_string(0, columns)
|
257
|
-
end
|
258
|
-
|
259
243
|
private
|
260
244
|
|
261
245
|
def within_foreground_thread(hwnd)
|
@@ -7,23 +7,13 @@ module RAutomation
|
|
7
7
|
include Locators
|
8
8
|
|
9
9
|
def count
|
10
|
-
UiaDll::
|
10
|
+
UiaDll::select_list_count search_information
|
11
11
|
end
|
12
12
|
|
13
13
|
def items
|
14
|
-
|
15
|
-
|
16
|
-
length = UiaDll::find_children(uia_element, children)
|
17
|
-
|
18
|
-
children.read_array_of_pointer(length).each do |child|
|
19
|
-
if (UiaDll::current_control_type(child) == Constants::UIA_LIST_ITEM_CONTROL_TYPE) or (UiaDll::current_control_type(child) == Constants::UIA_DATA_ITEM_CONTROL_TYPE)
|
20
|
-
child_name = FFI::MemoryPointer.new :char, UiaDll::get_name(child, nil) + 1
|
21
|
-
UiaDll::get_name(child, child_name)
|
22
|
-
list_items.push(@window.list_item(:value => child_name.read_string))
|
23
|
-
end
|
14
|
+
UiaDll::find_table_values(search_information).map do |list_item|
|
15
|
+
@window.list_item(:value => list_item)
|
24
16
|
end
|
25
|
-
|
26
|
-
list_items
|
27
17
|
end
|
28
18
|
|
29
19
|
def strings
|
@@ -31,13 +21,7 @@ module RAutomation
|
|
31
21
|
end
|
32
22
|
|
33
23
|
def value
|
34
|
-
|
35
|
-
if selected?(index)
|
36
|
-
return strings[index]
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
""
|
24
|
+
UiaDll::selection search_information
|
41
25
|
end
|
42
26
|
|
43
27
|
def exist?
|
@@ -55,13 +39,7 @@ module RAutomation
|
|
55
39
|
end
|
56
40
|
|
57
41
|
def select(index)
|
58
|
-
|
59
|
-
|
60
|
-
length = UiaDll::find_children(uia_element, children)
|
61
|
-
|
62
|
-
target_element = children.read_array_of_pointer(length)[index]
|
63
|
-
|
64
|
-
UiaDll::select(target_element)
|
42
|
+
UiaDll::select_list_select_index search_information, index
|
65
43
|
end
|
66
44
|
|
67
45
|
def list_boundary
|
@@ -5,43 +5,16 @@ module RAutomation
|
|
5
5
|
include WaitHelper
|
6
6
|
include Locators
|
7
7
|
|
8
|
-
#Can't get by value without a handle or a bug fix in the new way of getting a control by value so this is a workaround
|
9
|
-
def uia_element
|
10
|
-
if @locators[:value]
|
11
|
-
uia_window = UiaDll::element_from_handle(@window.hwnd)
|
12
|
-
begin
|
13
|
-
uia_window.read_pointer
|
14
|
-
rescue FFI::NullPointerError => e
|
15
|
-
raise UnknownElementException, "Window with handle #{@window.hwnd} does not exist"
|
16
|
-
end
|
17
|
-
uia_control = UiaDll::find_child_by_name(uia_window, @locators[:value].to_s)
|
18
|
-
begin
|
19
|
-
uia_control.read_pointer
|
20
|
-
rescue FFI::NullPointerError => e
|
21
|
-
raise UnknownElementException, "#{@locators[:value]} does not exist"
|
22
|
-
end
|
23
|
-
uia_control
|
24
|
-
else
|
25
|
-
super
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def value
|
30
|
-
list_item = uia_element
|
31
|
-
item_value = FFI::MemoryPointer.new :char, UiaDll::get_name(list_item, nil) + 1
|
32
|
-
UiaDll::get_name(list_item, item_value)
|
33
|
-
item_value.read_string
|
34
|
-
end
|
35
|
-
|
36
8
|
def exist?
|
37
9
|
super && matches_type?(Constants::UIA_LIST_ITEM_CONTROL_TYPE)
|
38
10
|
end
|
39
11
|
|
40
12
|
def selected?
|
41
|
-
UiaDll::
|
13
|
+
UiaDll::is_selected(search_information)
|
42
14
|
end
|
43
15
|
|
44
16
|
alias_method :exists?, :exist?
|
17
|
+
alias_method :value, :control_name
|
45
18
|
|
46
19
|
end
|
47
20
|
end
|