rautomation 2.0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.gitignore +41 -0
- data/.rspec +2 -0
- data/.yardopts +8 -0
- data/CHANGES.md +276 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +142 -0
- data/Rakefile +73 -0
- data/ext/AutoItX/AutoItX.chm +0 -0
- data/ext/AutoItX/AutoItX3.dll +0 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.cpp +30 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj +179 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.filters +42 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.user +3 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/ReadMe.txt +48 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/dllmain.cpp +19 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/stdafx.cpp +8 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/stdafx.h +22 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/table_support.cpp +282 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/targetver.h +8 -0
- data/ext/IAccessibleDLL/IAccessibleDLL.sln +31 -0
- data/ext/IAccessibleDLL/IAccessibleDLL.suo +0 -0
- data/ext/IAccessibleDLL/Release/IAccessibleDLL.dll +0 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/Clicker.cs +63 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/SelectList.cs +116 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/Spinner.cs +46 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/TabControl.cs +54 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/TableControl.cs +132 -0
- data/ext/UiaDll/RAutomation.UIA/Controls/TextControl.cs +50 -0
- data/ext/UiaDll/RAutomation.UIA/Expander.cs +59 -0
- data/ext/UiaDll/RAutomation.UIA/Extensions/Element.cs +166 -0
- data/ext/UiaDll/RAutomation.UIA/Extensions/Enumerable.cs +76 -0
- data/ext/UiaDll/RAutomation.UIA/Extensions/Property.cs +27 -0
- data/ext/UiaDll/RAutomation.UIA/Properties/AssemblyInfo.cs +36 -0
- data/ext/UiaDll/RAutomation.UIA/Properties/AutomationProperties.cs +18 -0
- data/ext/UiaDll/RAutomation.UIA/RAutomation.UIA.csproj +77 -0
- data/ext/UiaDll/Release/RAutomation.UIA.dll +0 -0
- data/ext/UiaDll/Release/UiaDll.dll +0 -0
- data/ext/UiaDll/UiaDll/ArrayHelper.cpp +14 -0
- data/ext/UiaDll/UiaDll/ArrayHelper.h +7 -0
- data/ext/UiaDll/UiaDll/AssemblyInfo.cpp +40 -0
- data/ext/UiaDll/UiaDll/ControlMethods.cpp +16 -0
- data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.cpp +24 -0
- data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.h +16 -0
- data/ext/UiaDll/UiaDll/Locator.cpp +93 -0
- data/ext/UiaDll/UiaDll/Locator.h +55 -0
- data/ext/UiaDll/UiaDll/MenuItemSelector.cpp +75 -0
- data/ext/UiaDll/UiaDll/MenuItemSelector.h +24 -0
- data/ext/UiaDll/UiaDll/MenuMethods.cpp +62 -0
- data/ext/UiaDll/UiaDll/ReadMe.txt +38 -0
- data/ext/UiaDll/UiaDll/SelectListMethods.cpp +84 -0
- data/ext/UiaDll/UiaDll/SpinnerMethods.cpp +61 -0
- data/ext/UiaDll/UiaDll/StringHelper.cpp +57 -0
- data/ext/UiaDll/UiaDll/StringHelper.h +15 -0
- data/ext/UiaDll/UiaDll/StringMethods.cpp +8 -0
- data/ext/UiaDll/UiaDll/TabControlMethods.cpp +40 -0
- data/ext/UiaDll/UiaDll/TableMethods.cpp +108 -0
- data/ext/UiaDll/UiaDll/TextMethods.cpp +25 -0
- data/ext/UiaDll/UiaDll/ToggleStateHelper.h +10 -0
- data/ext/UiaDll/UiaDll/UiaDll.cpp +216 -0
- data/ext/UiaDll/UiaDll/UiaDll.h +13 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +167 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +110 -0
- data/ext/UiaDll/UiaDll/app.ico +0 -0
- data/ext/UiaDll/UiaDll/app.rc +0 -0
- data/ext/UiaDll/UiaDll/dllmain.cpp +1 -0
- data/ext/UiaDll/UiaDll/resource.h +3 -0
- data/ext/UiaDll/UiaDll/stdafx.cpp +5 -0
- data/ext/UiaDll/UiaDll/stdafx.h +41 -0
- data/ext/UiaDll/UiaDll/targetver.h +8 -0
- data/ext/UiaDll/UiaDll.sln +57 -0
- data/ext/WindowsForms/.nuget/NuGet.Config +6 -0
- data/ext/WindowsForms/.nuget/NuGet.exe +0 -0
- data/ext/WindowsForms/.nuget/NuGet.targets +136 -0
- data/ext/WindowsForms/Release/FizzWare.NBuilder.dll +0 -0
- data/ext/WindowsForms/Release/UIA.Extensions.dll +0 -0
- data/ext/WindowsForms/Release/WindowsForms.exe +0 -0
- data/ext/WindowsForms/WindowsForms/AboutBox.Designer.cs +168 -0
- data/ext/WindowsForms/WindowsForms/AboutBox.cs +103 -0
- data/ext/WindowsForms/WindowsForms/AboutBox.resx +123 -0
- data/ext/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +218 -0
- data/ext/WindowsForms/WindowsForms/DataEntryForm.cs +52 -0
- data/ext/WindowsForms/WindowsForms/DataEntryForm.resx +120 -0
- data/ext/WindowsForms/WindowsForms/DataGridView.Designer.cs +77 -0
- data/ext/WindowsForms/WindowsForms/DataGridView.cs +43 -0
- data/ext/WindowsForms/WindowsForms/DataGridView.resx +120 -0
- data/ext/WindowsForms/WindowsForms/FizzWare.NBuilder.dll +0 -0
- data/ext/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +527 -0
- data/ext/WindowsForms/WindowsForms/MainFormWindow.cs +109 -0
- data/ext/WindowsForms/WindowsForms/MainFormWindow.resx +126 -0
- data/ext/WindowsForms/WindowsForms/PersonForm.Designer.cs +119 -0
- data/ext/WindowsForms/WindowsForms/PersonForm.cs +34 -0
- data/ext/WindowsForms/WindowsForms/PersonForm.resx +120 -0
- data/ext/WindowsForms/WindowsForms/Program.cs +21 -0
- data/ext/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs +36 -0
- data/ext/WindowsForms/WindowsForms/Properties/Resources.Designer.cs +71 -0
- data/ext/WindowsForms/WindowsForms/Properties/Resources.resx +117 -0
- data/ext/WindowsForms/WindowsForms/Properties/Settings.Designer.cs +30 -0
- data/ext/WindowsForms/WindowsForms/Properties/Settings.settings +7 -0
- data/ext/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs +93 -0
- data/ext/WindowsForms/WindowsForms/SimpleElementsForm.cs +19 -0
- data/ext/WindowsForms/WindowsForms/SimpleElementsForm.resx +120 -0
- data/ext/WindowsForms/WindowsForms/UIA.Extensions.dll +0 -0
- data/ext/WindowsForms/WindowsForms/ValueMonthCalendar.cs +28 -0
- data/ext/WindowsForms/WindowsForms/WindowsForms.csproj +166 -0
- data/ext/WindowsForms/WindowsForms/packages.config +4 -0
- data/ext/WindowsForms/WindowsForms.sln +46 -0
- data/lib/rautomation/adapter/autoit/button.rb +59 -0
- data/lib/rautomation/adapter/autoit/locators.rb +22 -0
- data/lib/rautomation/adapter/autoit/mouse.rb +38 -0
- data/lib/rautomation/adapter/autoit/text_field.rb +70 -0
- data/lib/rautomation/adapter/autoit/window.rb +197 -0
- data/lib/rautomation/adapter/autoit.rb +8 -0
- data/lib/rautomation/adapter/helper.rb +64 -0
- data/lib/rautomation/adapter/ms_uia/button.rb +21 -0
- data/lib/rautomation/adapter/ms_uia/button_helper.rb +19 -0
- data/lib/rautomation/adapter/ms_uia/checkbox.rb +23 -0
- data/lib/rautomation/adapter/ms_uia/constants.rb +111 -0
- data/lib/rautomation/adapter/ms_uia/control.rb +134 -0
- data/lib/rautomation/adapter/ms_uia/functions.rb +279 -0
- data/lib/rautomation/adapter/ms_uia/keys.rb +121 -0
- data/lib/rautomation/adapter/ms_uia/keystroke_converter.rb +122 -0
- data/lib/rautomation/adapter/ms_uia/label.rb +18 -0
- data/lib/rautomation/adapter/ms_uia/list_box.rb +46 -0
- data/lib/rautomation/adapter/ms_uia/list_item.rb +22 -0
- data/lib/rautomation/adapter/ms_uia/locators.rb +23 -0
- data/lib/rautomation/adapter/ms_uia/menu.rb +36 -0
- data/lib/rautomation/adapter/ms_uia/radio.rb +23 -0
- data/lib/rautomation/adapter/ms_uia/select_list.rb +85 -0
- data/lib/rautomation/adapter/ms_uia/spinner.rb +31 -0
- data/lib/rautomation/adapter/ms_uia/tab_control.rb +46 -0
- data/lib/rautomation/adapter/ms_uia/table.rb +140 -0
- data/lib/rautomation/adapter/ms_uia/text_field.rb +39 -0
- data/lib/rautomation/adapter/ms_uia/uia_dll.rb +428 -0
- data/lib/rautomation/adapter/ms_uia/value_control.rb +21 -0
- data/lib/rautomation/adapter/ms_uia/window.rb +289 -0
- data/lib/rautomation/adapter/ms_uia.rb +27 -0
- data/lib/rautomation/adapter/win_32/button.rb +14 -0
- data/lib/rautomation/adapter/win_32/button_helper.rb +24 -0
- data/lib/rautomation/adapter/win_32/checkbox.rb +14 -0
- data/lib/rautomation/adapter/win_32/constants.rb +73 -0
- data/lib/rautomation/adapter/win_32/control.rb +86 -0
- data/lib/rautomation/adapter/win_32/functions.rb +336 -0
- data/lib/rautomation/adapter/win_32/keys.rb +146 -0
- data/lib/rautomation/adapter/win_32/label.rb +10 -0
- data/lib/rautomation/adapter/win_32/list_box.rb +40 -0
- data/lib/rautomation/adapter/win_32/locators.rb +22 -0
- data/lib/rautomation/adapter/win_32/mouse.rb +59 -0
- data/lib/rautomation/adapter/win_32/password_field.rb +15 -0
- data/lib/rautomation/adapter/win_32/radio.rb +11 -0
- data/lib/rautomation/adapter/win_32/select_list.rb +97 -0
- data/lib/rautomation/adapter/win_32/table.rb +25 -0
- data/lib/rautomation/adapter/win_32/text_field.rb +52 -0
- data/lib/rautomation/adapter/win_32/window.rb +277 -0
- data/lib/rautomation/adapter/win_32.rb +23 -0
- data/lib/rautomation/button.rb +55 -0
- data/lib/rautomation/element_collections.rb +55 -0
- data/lib/rautomation/platform.rb +15 -0
- data/lib/rautomation/text_field.rb +60 -0
- data/lib/rautomation/version.rb +3 -0
- data/lib/rautomation/wait_helper.rb +23 -0
- data/lib/rautomation/window.rb +248 -0
- data/lib/rautomation.rb +8 -0
- data/rautomation.gemspec +52 -0
- data/spec/adapter/autoit/mouse_spec.rb +53 -0
- data/spec/adapter/autoit/window_spec.rb +17 -0
- data/spec/adapter/ms_uia/button_spec.rb +39 -0
- data/spec/adapter/ms_uia/checkbox_spec.rb +55 -0
- data/spec/adapter/ms_uia/control_spec.rb +88 -0
- data/spec/adapter/ms_uia/functions_spec.rb +39 -0
- data/spec/adapter/ms_uia/keystroke_converter_spec.rb +48 -0
- data/spec/adapter/ms_uia/label_spec.rb +18 -0
- data/spec/adapter/ms_uia/list_item_spec.rb +14 -0
- data/spec/adapter/ms_uia/listbox_spec.rb +73 -0
- data/spec/adapter/ms_uia/radio_spec.rb +39 -0
- data/spec/adapter/ms_uia/select_list_spec.rb +118 -0
- data/spec/adapter/ms_uia/spinner_spec.rb +44 -0
- data/spec/adapter/ms_uia/tab_control_spec.rb +53 -0
- data/spec/adapter/ms_uia/table_spec.rb +197 -0
- data/spec/adapter/ms_uia/text_field_spec.rb +43 -0
- data/spec/adapter/ms_uia/value_control_spec.rb +11 -0
- data/spec/adapter/ms_uia/window_spec.rb +81 -0
- data/spec/adapter/win_32/button_spec.rb +31 -0
- data/spec/adapter/win_32/checkbox_spec.rb +46 -0
- data/spec/adapter/win_32/label_spec.rb +13 -0
- data/spec/adapter/win_32/listbox_spec.rb +41 -0
- data/spec/adapter/win_32/mouse_spec.rb +49 -0
- data/spec/adapter/win_32/radio_spec.rb +33 -0
- data/spec/adapter/win_32/select_list_spec.rb +65 -0
- data/spec/adapter/win_32/table_spec.rb +27 -0
- data/spec/adapter/win_32/text_field_spec.rb +24 -0
- data/spec/adapter/win_32/window_spec.rb +61 -0
- data/spec/button_spec.rb +67 -0
- data/spec/buttons_spec.rb +21 -0
- data/spec/spec_helper.rb +128 -0
- data/spec/text_field_spec.rb +64 -0
- data/spec/text_fields_spec.rb +22 -0
- data/spec/window_spec.rb +150 -0
- data/spec/windows_spec.rb +76 -0
- metadata +369 -0
@@ -0,0 +1,85 @@
|
|
1
|
+
module RAutomation
|
2
|
+
module Adapter
|
3
|
+
module MsUia
|
4
|
+
|
5
|
+
class SelectList < Control
|
6
|
+
include WaitHelper
|
7
|
+
include Locators
|
8
|
+
|
9
|
+
class SelectListOption
|
10
|
+
attr_accessor :text, :index
|
11
|
+
|
12
|
+
def initialize(select_list, text, index)
|
13
|
+
@select_list = select_list
|
14
|
+
@text = text
|
15
|
+
@index = index
|
16
|
+
end
|
17
|
+
|
18
|
+
def selected?
|
19
|
+
@index == UiaDll::select_list_selected_index(@select_list.search_information)
|
20
|
+
end
|
21
|
+
|
22
|
+
def select
|
23
|
+
@select_list.assert_enabled
|
24
|
+
UiaDll::select_list_select_index @select_list.search_information, @index
|
25
|
+
end
|
26
|
+
|
27
|
+
def clear
|
28
|
+
UiaDll::remove_from_selection @select_list.search_information, @index
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.locators_match?(locators, item)
|
32
|
+
locators.all? do |locator, value|
|
33
|
+
return item.text =~ value if value.is_a? Regexp
|
34
|
+
return item.send(locator) == value
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
alias_method :set, :select
|
39
|
+
end
|
40
|
+
|
41
|
+
def option(locator)
|
42
|
+
options(locator).first
|
43
|
+
end
|
44
|
+
|
45
|
+
def options(locator = {})
|
46
|
+
all_options.select { |item| SelectListOption.locators_match? locator, item }
|
47
|
+
end
|
48
|
+
|
49
|
+
def select(locator = {})
|
50
|
+
options(locator).each(&:select)
|
51
|
+
end
|
52
|
+
|
53
|
+
def clear(locator = {})
|
54
|
+
options(locator).each(&:clear)
|
55
|
+
end
|
56
|
+
|
57
|
+
def value
|
58
|
+
UiaDll::selection(search_information)
|
59
|
+
end
|
60
|
+
|
61
|
+
def values
|
62
|
+
UiaDll::selections(search_information)
|
63
|
+
end
|
64
|
+
|
65
|
+
def exist?
|
66
|
+
super && matches_type?(Constants::UIA_COMBOBOX_CONTROL_TYPE)
|
67
|
+
end
|
68
|
+
|
69
|
+
alias_method :exists?, :exist?
|
70
|
+
|
71
|
+
private
|
72
|
+
def item_count
|
73
|
+
UiaDll::select_list_count(search_information)
|
74
|
+
end
|
75
|
+
|
76
|
+
def all_options
|
77
|
+
UiaDll::select_options(search_information).each_with_index.map do |item, index|
|
78
|
+
SelectListOption.new(self, item, index)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module RAutomation
|
2
|
+
module Adapter
|
3
|
+
module MsUia
|
4
|
+
class Spinner < Control
|
5
|
+
def set(value)
|
6
|
+
UiaDll::set_spinner_value(search_information, value)
|
7
|
+
end
|
8
|
+
|
9
|
+
def value
|
10
|
+
UiaDll::spinner_value(search_information)
|
11
|
+
end
|
12
|
+
|
13
|
+
def minimum
|
14
|
+
UiaDll::spinner_min(search_information)
|
15
|
+
end
|
16
|
+
|
17
|
+
def maximum
|
18
|
+
UiaDll::spinner_max(search_information)
|
19
|
+
end
|
20
|
+
|
21
|
+
def increment
|
22
|
+
UiaDll::increment_spinner(search_information)
|
23
|
+
end
|
24
|
+
|
25
|
+
def decrement
|
26
|
+
UiaDll::decrement_spinner(search_information)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module RAutomation
|
2
|
+
module Adapter
|
3
|
+
module MsUia
|
4
|
+
|
5
|
+
class TabControl < Control
|
6
|
+
class TabItem
|
7
|
+
attr_reader :text, :index
|
8
|
+
|
9
|
+
def initialize(tab_control, text, index)
|
10
|
+
@tab_control, @text, @index = tab_control, text, index
|
11
|
+
end
|
12
|
+
|
13
|
+
def select
|
14
|
+
UiaDll::select_tab(@tab_control.search_information, index)
|
15
|
+
end
|
16
|
+
|
17
|
+
def selected?
|
18
|
+
@index == UiaDll::tab_control_selected_index(@tab_control.search_information)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def select(index)
|
23
|
+
UiaDll::select_tab(search_information, index)
|
24
|
+
end
|
25
|
+
|
26
|
+
def set(value)
|
27
|
+
UiaDll::select_tab(search_information, value)
|
28
|
+
end
|
29
|
+
|
30
|
+
def items
|
31
|
+
values.each_with_index.map {|value, index| TabItem.new(self, value, index) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def value
|
35
|
+
UiaDll::tab_selection(search_information)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def values
|
40
|
+
UiaDll::tab_items(search_information)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
module RAutomation
|
2
|
+
module Adapter
|
3
|
+
module MsUia
|
4
|
+
class Cell
|
5
|
+
include Locators
|
6
|
+
attr_reader :row, :column, :search_information
|
7
|
+
|
8
|
+
def initialize(window, locators)
|
9
|
+
@search_information = window.search_information
|
10
|
+
@locators = extract(locators)
|
11
|
+
@row = window.row
|
12
|
+
@column = @locators[:index] || 0
|
13
|
+
end
|
14
|
+
|
15
|
+
def exists?
|
16
|
+
UiaDll::table_coordinate_valid? search_information, row, column
|
17
|
+
end
|
18
|
+
|
19
|
+
def value
|
20
|
+
UiaDll::table_value_at search_information, row, column
|
21
|
+
end
|
22
|
+
|
23
|
+
alias_method :text, :value
|
24
|
+
alias_method :index, :column
|
25
|
+
end
|
26
|
+
|
27
|
+
class Row
|
28
|
+
include Locators
|
29
|
+
extend ElementCollections
|
30
|
+
attr_reader :search_information
|
31
|
+
|
32
|
+
has_many :cells
|
33
|
+
|
34
|
+
def cells(locators={})
|
35
|
+
Cells.new(self, locators).select do |cell|
|
36
|
+
Row.locators_match? locators, cell
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def cell(locators={})
|
41
|
+
cells(locators).first
|
42
|
+
end
|
43
|
+
|
44
|
+
def initialize(table, locators)
|
45
|
+
@table = table
|
46
|
+
@search_information = table.search_information
|
47
|
+
@locators = extract(locators)
|
48
|
+
end
|
49
|
+
|
50
|
+
def index
|
51
|
+
@locators[:index] || 0
|
52
|
+
end
|
53
|
+
|
54
|
+
def select
|
55
|
+
UiaDll::table_select search_information, row
|
56
|
+
end
|
57
|
+
|
58
|
+
def selected?
|
59
|
+
UiaDll::table_row_is_selected search_information, row
|
60
|
+
end
|
61
|
+
|
62
|
+
def clear
|
63
|
+
UiaDll::table_remove_from_selection search_information, row
|
64
|
+
end
|
65
|
+
|
66
|
+
def value
|
67
|
+
UiaDll::table_value_at search_information, @locators[:index]
|
68
|
+
end
|
69
|
+
|
70
|
+
def exists?
|
71
|
+
@locators[:index].between? 0, @table.row_count - 1
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.locators_match?(locators, item)
|
75
|
+
locators.all? do |locator, value|
|
76
|
+
return item.value =~ value if value.is_a? Regexp
|
77
|
+
return item.send(locator) == value
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
alias_method :text, :value
|
82
|
+
alias_method :row, :index
|
83
|
+
end
|
84
|
+
|
85
|
+
class Table < Control
|
86
|
+
include WaitHelper
|
87
|
+
include Locators
|
88
|
+
extend ElementCollections
|
89
|
+
|
90
|
+
has_many :rows
|
91
|
+
|
92
|
+
def row(locators={})
|
93
|
+
rows(locators).first
|
94
|
+
end
|
95
|
+
|
96
|
+
def rows(locators={})
|
97
|
+
Rows.new(self, locators).select do |row|
|
98
|
+
Row.locators_match? locators, row
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def select(locators={})
|
103
|
+
rows(locators).each(&:select)
|
104
|
+
end
|
105
|
+
|
106
|
+
def clear(locators={})
|
107
|
+
rows(locators).each(&:clear)
|
108
|
+
end
|
109
|
+
|
110
|
+
def selected_rows
|
111
|
+
UiaDll.table_selected_indexes(search_information).map {|index| Row.new(self, index: index) }
|
112
|
+
end
|
113
|
+
|
114
|
+
def strings
|
115
|
+
headers = UiaDll.table_headers(search_information)
|
116
|
+
values = UiaDll.table_values(search_information)
|
117
|
+
return values if headers.empty?
|
118
|
+
|
119
|
+
all_strings = [] << headers
|
120
|
+
values.each_slice(headers.count) {|r| all_strings << r }
|
121
|
+
all_strings
|
122
|
+
end
|
123
|
+
|
124
|
+
def row_count
|
125
|
+
UiaDll::table_row_count search_information
|
126
|
+
end
|
127
|
+
|
128
|
+
def exist?
|
129
|
+
super && of_type_table?
|
130
|
+
end
|
131
|
+
|
132
|
+
def of_type_table?
|
133
|
+
matches_type?(Constants::UIA_LIST_CONTROL_TYPE) || matches_type?(Constants::UIA_DATA_GRID_CONTROL_TYPE)
|
134
|
+
end
|
135
|
+
|
136
|
+
alias_method :exists?, :exist?
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module RAutomation
|
2
|
+
module Adapter
|
3
|
+
module MsUia
|
4
|
+
class TextField < Control
|
5
|
+
include WaitHelper
|
6
|
+
include Locators
|
7
|
+
|
8
|
+
# Default locators used for searching text fields.
|
9
|
+
DEFAULT_LOCATORS = {:class => /edit/i}
|
10
|
+
|
11
|
+
#todo - replace with UIA version
|
12
|
+
# @see RAutomation::TextField#set
|
13
|
+
def set(text)
|
14
|
+
raise "Cannot set value on a disabled text field" if disabled?
|
15
|
+
UiaDll::set_text(search_information, text)
|
16
|
+
end
|
17
|
+
|
18
|
+
# @see RAutomation::TextField#clear
|
19
|
+
def clear
|
20
|
+
raise "Cannot set value on a disabled text field" if disabled?
|
21
|
+
set ""
|
22
|
+
end
|
23
|
+
|
24
|
+
#todo - replace with UIA version
|
25
|
+
# @see RAutomation::TextField#value
|
26
|
+
def value
|
27
|
+
UiaDll::get_text(search_information)
|
28
|
+
end
|
29
|
+
|
30
|
+
def exist?
|
31
|
+
super && matches_type?(Constants::UIA_EDIT_CONTROL_TYPE, Constants::UIA_DOCUMENT_CONTROL_TYPE)
|
32
|
+
end
|
33
|
+
|
34
|
+
alias_method :exists?, :exist?
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|