bewildr 0.1.2 → 0.1.3
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/Rakefile +2 -2
- data/lib/bewildr.rb +1 -0
- data/lib/bewildr/application.rb +2 -1
- data/lib/bewildr/control_patterns/grid_pattern.rb +5 -0
- data/lib/bewildr/control_patterns/invoke_pattern.rb +10 -10
- data/lib/bewildr/control_patterns/table_item_pattern.rb +15 -0
- data/lib/bewildr/control_patterns/table_pattern.rb +20 -17
- data/lib/bewildr/control_patterns/toggle_pattern.rb +1 -1
- data/lib/bewildr/control_patterns/value_pattern.rb +2 -1
- data/lib/bewildr/control_type_additions/combo_box_additions.rb +86 -86
- data/lib/bewildr/control_type_additions/data_grid_additions.rb +3 -1
- data/lib/bewildr/control_type_additions/list_additions.rb +57 -57
- data/lib/bewildr/control_type_additions/menu_additions.rb +64 -64
- data/lib/bewildr/control_type_additions/menu_item_additions.rb +18 -18
- data/lib/bewildr/control_type_additions/tab_additions.rb +31 -31
- data/lib/bewildr/control_type_additions/tree_additions.rb +3 -3
- data/lib/bewildr/element.rb +208 -189
- data/lib/bewildr/exceptions.rb +9 -8
- data/lib/bewildr/finder.rb +66 -66
- metadata +5 -4
@@ -1,64 +1,64 @@
|
|
1
|
-
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
|
-
|
3
|
-
module Bewildr
|
4
|
-
module ControlTypeAdditions
|
5
|
-
module MenuAdditions
|
6
|
-
def self.extended(base)
|
7
|
-
base.extend Bewildr::ControlPatterns::ExpandCollapsePattern
|
8
|
-
base.extend Bewildr::ControlPatterns::SelectionPattern
|
9
|
-
base.extend Bewildr::ControlPatterns::SelectionItemPattern
|
10
|
-
|
11
|
-
base.instance_eval do
|
12
|
-
def root_menu_items
|
13
|
-
get(:type
|
14
|
-
end
|
15
|
-
|
16
|
-
def root_menu_item_names
|
17
|
-
root_menu_items.collect {|menu_item| menu_item.name}
|
18
|
-
end
|
19
|
-
|
20
|
-
def select_menu(path)
|
21
|
-
menu_item(path).click
|
22
|
-
end
|
23
|
-
|
24
|
-
def select_node(path)
|
25
|
-
node(path).select
|
26
|
-
end
|
27
|
-
|
28
|
-
def menu_item(path)
|
29
|
-
current_menu_items = root_menu_items
|
30
|
-
matching_menu_item = nil
|
31
|
-
path.each_with_index do |target_menu_item, index|
|
32
|
-
case current_menu_items
|
33
|
-
when Array
|
34
|
-
matching_menu_item = current_menu_items.find {|node| node.name == target_menu_item} #TODO: make this work with regexes as well as strings...
|
35
|
-
raise ElementDoesntExist if matching_menu_item.nil?
|
36
|
-
when Bewildr::Element
|
37
|
-
if current_menu_items.name == target_menu_item #TODO: make this work with regexes as well as strings...
|
38
|
-
matching_menu_item = current_menu_items
|
39
|
-
else
|
40
|
-
raise ElementDoesntExist
|
41
|
-
end
|
42
|
-
end
|
43
|
-
raise ElementDoesntExist if matching_menu_item.nil?
|
44
|
-
if path.size != index + 1
|
45
|
-
matching_menu_item.expand
|
46
|
-
current_menu_items = matching_menu_item.sub_menus
|
47
|
-
end
|
48
|
-
end
|
49
|
-
return matching_menu_item
|
50
|
-
end
|
51
|
-
|
52
|
-
def contains_menu_item?(path)
|
53
|
-
begin
|
54
|
-
menu_item(path)
|
55
|
-
return true
|
56
|
-
rescue ElementDoesntExist => e
|
57
|
-
return false
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
1
|
+
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
|
+
|
3
|
+
module Bewildr
|
4
|
+
module ControlTypeAdditions
|
5
|
+
module MenuAdditions
|
6
|
+
def self.extended(base)
|
7
|
+
base.extend Bewildr::ControlPatterns::ExpandCollapsePattern
|
8
|
+
base.extend Bewildr::ControlPatterns::SelectionPattern
|
9
|
+
base.extend Bewildr::ControlPatterns::SelectionItemPattern
|
10
|
+
|
11
|
+
base.instance_eval do
|
12
|
+
def root_menu_items
|
13
|
+
get(:type => :menu_item, :scope => :children, :how_many => :all)
|
14
|
+
end
|
15
|
+
|
16
|
+
def root_menu_item_names
|
17
|
+
root_menu_items.collect {|menu_item| menu_item.name}
|
18
|
+
end
|
19
|
+
|
20
|
+
def select_menu(path)
|
21
|
+
menu_item(path).click
|
22
|
+
end
|
23
|
+
|
24
|
+
def select_node(path)
|
25
|
+
node(path).select
|
26
|
+
end
|
27
|
+
|
28
|
+
def menu_item(path)
|
29
|
+
current_menu_items = root_menu_items
|
30
|
+
matching_menu_item = nil
|
31
|
+
path.each_with_index do |target_menu_item, index|
|
32
|
+
case current_menu_items
|
33
|
+
when Array
|
34
|
+
matching_menu_item = current_menu_items.find {|node| node.name == target_menu_item} #TODO: make this work with regexes as well as strings...
|
35
|
+
raise Bewildr::ElementDoesntExist if matching_menu_item.nil?
|
36
|
+
when Bewildr::Element
|
37
|
+
if current_menu_items.name == target_menu_item #TODO: make this work with regexes as well as strings...
|
38
|
+
matching_menu_item = current_menu_items
|
39
|
+
else
|
40
|
+
raise Bewildr::ElementDoesntExist
|
41
|
+
end
|
42
|
+
end
|
43
|
+
raise Bewildr::ElementDoesntExist if matching_menu_item.nil?
|
44
|
+
if path.size != index + 1
|
45
|
+
matching_menu_item.expand
|
46
|
+
current_menu_items = matching_menu_item.sub_menus
|
47
|
+
end
|
48
|
+
end
|
49
|
+
return matching_menu_item
|
50
|
+
end
|
51
|
+
|
52
|
+
def contains_menu_item?(path)
|
53
|
+
begin
|
54
|
+
menu_item(path)
|
55
|
+
return true
|
56
|
+
rescue ElementDoesntExist => e
|
57
|
+
return false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
|
-
|
3
|
-
module Bewildr
|
4
|
-
module ControlTypeAdditions
|
5
|
-
module MenuItemAdditions
|
6
|
-
def self.extended(base)
|
7
|
-
base.extend Bewildr::ControlPatterns::ExpandCollapsePattern
|
8
|
-
base.extend Bewildr::ControlPatterns::InvokePattern
|
9
|
-
|
10
|
-
base.instance_eval do
|
11
|
-
def sub_menus
|
12
|
-
get(:type => :menu_item, :scope => :children)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
1
|
+
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
|
+
|
3
|
+
module Bewildr
|
4
|
+
module ControlTypeAdditions
|
5
|
+
module MenuItemAdditions
|
6
|
+
def self.extended(base)
|
7
|
+
base.extend Bewildr::ControlPatterns::ExpandCollapsePattern
|
8
|
+
base.extend Bewildr::ControlPatterns::InvokePattern
|
9
|
+
|
10
|
+
base.instance_eval do
|
11
|
+
def sub_menus
|
12
|
+
get(:type => :menu_item, :scope => :children, :how_many => :all)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,31 +1,31 @@
|
|
1
|
-
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
|
-
|
3
|
-
module Bewildr
|
4
|
-
module ControlTypeAdditions
|
5
|
-
module TabAdditions
|
6
|
-
def self.extended(base)
|
7
|
-
base.extend Bewildr::ControlPatterns::SelectionPattern
|
8
|
-
|
9
|
-
base.instance_eval do
|
10
|
-
def select(input)
|
11
|
-
raise NoSuchTab unless tab_names.include?(input)
|
12
|
-
selectable_elements = tabs
|
13
|
-
selectable_elements.find {|selectable_element| selectable_element.name == input}.select
|
14
|
-
end
|
15
|
-
|
16
|
-
def tabs
|
17
|
-
get(:type => :tab_item, :scope => :children)
|
18
|
-
end
|
19
|
-
|
20
|
-
def tab_names
|
21
|
-
tabs.collect {|tab| tab.name}
|
22
|
-
end
|
23
|
-
|
24
|
-
def selected
|
25
|
-
tabs.find {|tab| tab.selected?}
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
1
|
+
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
|
+
|
3
|
+
module Bewildr
|
4
|
+
module ControlTypeAdditions
|
5
|
+
module TabAdditions
|
6
|
+
def self.extended(base)
|
7
|
+
base.extend Bewildr::ControlPatterns::SelectionPattern
|
8
|
+
|
9
|
+
base.instance_eval do
|
10
|
+
def select(input)
|
11
|
+
raise Bewildr::NoSuchTab unless tab_names.include?(input)
|
12
|
+
selectable_elements = tabs
|
13
|
+
selectable_elements.find {|selectable_element| selectable_element.name == input}.select
|
14
|
+
end
|
15
|
+
|
16
|
+
def tabs
|
17
|
+
get(:type => :tab_item, :scope => :children, :how_many => :all)
|
18
|
+
end
|
19
|
+
|
20
|
+
def tab_names
|
21
|
+
tabs.collect {|tab| tab.name}
|
22
|
+
end
|
23
|
+
|
24
|
+
def selected
|
25
|
+
tabs.find {|tab| tab.selected?}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -27,15 +27,15 @@ module Bewildr
|
|
27
27
|
case current_nodes
|
28
28
|
when Array
|
29
29
|
matching_node = current_nodes.find {|node| node.name == target_node} #TODO: make this work with regexes as well as strings...
|
30
|
-
raise ElementDoesntExist if matching_node.nil?
|
30
|
+
raise Bewildr::ElementDoesntExist if matching_node.nil?
|
31
31
|
when Bewildr::Element
|
32
32
|
if current_nodes.name == target_node #TODO: make this work with regexes as well as strings...
|
33
33
|
matching_node = current_nodes
|
34
34
|
else
|
35
|
-
raise ElementDoesntExist
|
35
|
+
raise Bewildr::ElementDoesntExist
|
36
36
|
end
|
37
37
|
end
|
38
|
-
raise ElementDoesntExist if matching_node.nil?
|
38
|
+
raise Bewildr::ElementDoesntExist if matching_node.nil?
|
39
39
|
if path.size != index + 1
|
40
40
|
matching_node.expand
|
41
41
|
current_nodes = matching_node.child_nodes
|
data/lib/bewildr/element.rb
CHANGED
@@ -1,190 +1,209 @@
|
|
1
|
-
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
|
-
|
3
|
-
module Bewildr
|
4
|
-
class Element
|
5
|
-
attr_reader :automation_element
|
6
|
-
attr_reader :control_type
|
7
|
-
|
8
|
-
def initialize(input)
|
9
|
-
@automation_element = input
|
10
|
-
case input
|
11
|
-
when System::Windows::Automation::AutomationElement
|
12
|
-
set_control_type
|
13
|
-
build_element
|
14
|
-
when nil then @control_type = :non_existent
|
15
|
-
else raise BewildrInternalError, "Can only initialize an element with a nil or a Sys::Win::Auto::AE[C], not a #{input.class}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def name
|
20
|
-
existence_check
|
21
|
-
@automation_element.current.name.to_s
|
22
|
-
end
|
23
|
-
|
24
|
-
def automation_id
|
25
|
-
existence_check
|
26
|
-
@automation_element.current.automation_id.to_s
|
27
|
-
end
|
28
|
-
|
29
|
-
def exists?
|
30
|
-
return false if @control_type == :non_existent
|
31
|
-
begin
|
32
|
-
@automation_element.current.bounding_rectangle
|
33
|
-
return true
|
34
|
-
rescue System::Windows::Automation::ElementNotAvailableException, TypeError => e
|
35
|
-
return false
|
36
|
-
end
|
37
|
-
end
|
38
|
-
alias :exist? :exists?
|
39
|
-
|
40
|
-
def contains?(condition_hash)
|
41
|
-
get(condition_hash).exists?
|
42
|
-
end
|
43
|
-
alias :contain? :contains?
|
44
|
-
|
45
|
-
def existence_check
|
46
|
-
raise ElementDoesntExist unless exists?
|
47
|
-
end
|
48
|
-
private :existence_check
|
49
|
-
|
50
|
-
def enabled?
|
51
|
-
existence_check
|
52
|
-
@automation_element.current.is_enabled
|
53
|
-
end
|
54
|
-
|
55
|
-
def wait_for_existence_of(condition_hash)
|
56
|
-
Timeout.timeout(30) do
|
57
|
-
sleep 0.1 until contains?(condition_hash)
|
58
|
-
end
|
59
|
-
get(condition_hash)
|
60
|
-
end
|
61
|
-
|
62
|
-
def wait_for_non_existence_of(condition_hash)
|
63
|
-
Timeout.timeout(30) do
|
64
|
-
sleep 0.1 unless contains?(condition_hash)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def focus
|
69
|
-
@automation_element.set_focus
|
70
|
-
end
|
71
|
-
|
72
|
-
#:id => "id"
|
73
|
-
#:name => "bob"
|
74
|
-
#:type => :button
|
75
|
-
#:scope => :children / :descendants
|
76
|
-
#:how_many => :first / :all
|
77
|
-
def get(condition_hash)
|
78
|
-
existence_check
|
79
|
-
condition = Finder.condition_for(condition_hash)
|
80
|
-
scope = Finder.scope_for(condition_hash)
|
81
|
-
how_many = Finder.how_many_for(condition_hash)
|
82
|
-
|
83
|
-
result = @automation_element.send how_many, scope, condition
|
84
|
-
case result
|
85
|
-
when System::Windows::Automation::AutomationElement, nil then return Bewildr::Element.new(result)
|
86
|
-
when System::Windows::Automation::AutomationElementCollection
|
87
|
-
c_array_list = System::Collections::ArrayList.new(result)
|
88
|
-
element_array = c_array_list.to_array.to_a
|
89
|
-
case
|
90
|
-
when element_array.size == 0 then return Bewildr::Element.new(nil)
|
91
|
-
when element_array.size == 1 then return Bewildr::Element.new(element_array.first)
|
92
|
-
when element_array.size
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
#add "children/child" and "descendants/descendant" methods
|
98
|
-
|
99
|
-
def children
|
100
|
-
get({:scope => :children}).collect {|element| Bewildr::Element.new(element)}
|
101
|
-
end
|
102
|
-
|
103
|
-
def click
|
104
|
-
CLICKR.click(clickable_point)
|
105
|
-
end
|
106
|
-
|
107
|
-
def double_click
|
108
|
-
CLICKR.double_click(clickable_point)
|
109
|
-
end
|
110
|
-
|
111
|
-
def right_click
|
112
|
-
CLICKR.right_click(clickable_point)
|
113
|
-
end
|
114
|
-
|
115
|
-
def clickable_point
|
116
|
-
existence_check
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
when :
|
139
|
-
when :
|
140
|
-
extend Bewildr::
|
141
|
-
when :
|
142
|
-
extend Bewildr::
|
143
|
-
when :
|
144
|
-
|
145
|
-
when :
|
146
|
-
|
147
|
-
|
148
|
-
when :
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
when :
|
154
|
-
|
155
|
-
when :
|
156
|
-
|
157
|
-
|
158
|
-
when :
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
when :
|
165
|
-
when :
|
166
|
-
extend Bewildr::
|
167
|
-
when :
|
168
|
-
when :
|
169
|
-
|
170
|
-
when :
|
171
|
-
extend Bewildr::
|
172
|
-
when :
|
173
|
-
|
174
|
-
when :
|
175
|
-
|
176
|
-
|
177
|
-
when :
|
178
|
-
when :
|
179
|
-
when :
|
180
|
-
|
181
|
-
when :
|
182
|
-
extend Bewildr::
|
183
|
-
when :
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
1
|
+
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved.
|
2
|
+
|
3
|
+
module Bewildr
|
4
|
+
class Element
|
5
|
+
attr_reader :automation_element
|
6
|
+
attr_reader :control_type
|
7
|
+
|
8
|
+
def initialize(input)
|
9
|
+
@automation_element = input
|
10
|
+
case input
|
11
|
+
when System::Windows::Automation::AutomationElement
|
12
|
+
set_control_type
|
13
|
+
build_element
|
14
|
+
when nil then @control_type = :non_existent
|
15
|
+
else raise Bewildr::BewildrInternalError, "Can only initialize an element with a nil or a Sys::Win::Auto::AE[C], not a #{input.class}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def name
|
20
|
+
existence_check
|
21
|
+
@automation_element.current.name.to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def automation_id
|
25
|
+
existence_check
|
26
|
+
@automation_element.current.automation_id.to_s
|
27
|
+
end
|
28
|
+
|
29
|
+
def exists?
|
30
|
+
return false if @control_type == :non_existent
|
31
|
+
begin
|
32
|
+
@automation_element.current.bounding_rectangle
|
33
|
+
return true
|
34
|
+
rescue System::Windows::Automation::ElementNotAvailableException, TypeError => e
|
35
|
+
return false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
alias :exist? :exists?
|
39
|
+
|
40
|
+
def contains?(condition_hash)
|
41
|
+
get(condition_hash).exists?
|
42
|
+
end
|
43
|
+
alias :contain? :contains?
|
44
|
+
|
45
|
+
def existence_check
|
46
|
+
raise Bewildr::ElementDoesntExist unless exists?
|
47
|
+
end
|
48
|
+
private :existence_check
|
49
|
+
|
50
|
+
def enabled?
|
51
|
+
existence_check
|
52
|
+
@automation_element.current.is_enabled
|
53
|
+
end
|
54
|
+
|
55
|
+
def wait_for_existence_of(condition_hash)
|
56
|
+
Timeout.timeout(30) do
|
57
|
+
sleep 0.1 until contains?(condition_hash)
|
58
|
+
end
|
59
|
+
get(condition_hash)
|
60
|
+
end
|
61
|
+
|
62
|
+
def wait_for_non_existence_of(condition_hash)
|
63
|
+
Timeout.timeout(30) do
|
64
|
+
sleep 0.1 unless contains?(condition_hash)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def focus
|
69
|
+
@automation_element.set_focus
|
70
|
+
end
|
71
|
+
|
72
|
+
#:id => "id"
|
73
|
+
#:name => "bob"
|
74
|
+
#:type => :button
|
75
|
+
#:scope => :children / :descendants
|
76
|
+
#:how_many => :first / :all
|
77
|
+
def get(condition_hash)
|
78
|
+
existence_check
|
79
|
+
condition = Finder.condition_for(condition_hash)
|
80
|
+
scope = Finder.scope_for(condition_hash)
|
81
|
+
how_many = Finder.how_many_for(condition_hash)
|
82
|
+
|
83
|
+
result = @automation_element.send how_many, scope, condition
|
84
|
+
case result
|
85
|
+
when System::Windows::Automation::AutomationElement, nil then return Bewildr::Element.new(result)
|
86
|
+
when System::Windows::Automation::AutomationElementCollection
|
87
|
+
c_array_list = System::Collections::ArrayList.new(result)
|
88
|
+
element_array = c_array_list.to_array.to_a
|
89
|
+
case
|
90
|
+
when element_array.size == 0 then return Bewildr::Element.new(nil)
|
91
|
+
#when element_array.size == 1 then return Bewildr::Element.new(element_array.first)
|
92
|
+
when element_array.size > 0 then return element_array.collect {|element| Bewildr::Element.new(element) }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
#add "children/child" and "descendants/descendant" methods
|
98
|
+
|
99
|
+
def children
|
100
|
+
get({:scope => :children}).collect {|element| Bewildr::Element.new(element)}
|
101
|
+
end
|
102
|
+
|
103
|
+
def click
|
104
|
+
CLICKR.click(clickable_point)
|
105
|
+
end
|
106
|
+
|
107
|
+
def double_click
|
108
|
+
CLICKR.double_click(clickable_point)
|
109
|
+
end
|
110
|
+
|
111
|
+
def right_click
|
112
|
+
CLICKR.right_click(clickable_point)
|
113
|
+
end
|
114
|
+
|
115
|
+
def clickable_point
|
116
|
+
existence_check
|
117
|
+
Timeout.timeout(30) do
|
118
|
+
current_clickable_point = nil
|
119
|
+
begin
|
120
|
+
current_clickable_point = @automation_element.get_clickable_point
|
121
|
+
rescue System::Windows::Automation::NoClickablePointException
|
122
|
+
retry
|
123
|
+
end
|
124
|
+
return current_clickable_point
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
def set_control_type
|
131
|
+
@control_type = Bewildr::ControlType.symbol_for_enum(@automation_element.current.control_type)
|
132
|
+
end
|
133
|
+
|
134
|
+
#list of control types comes from http://msdn.microsoft.com/en-us/library/ms750574.aspx
|
135
|
+
def build_element
|
136
|
+
case @control_type
|
137
|
+
when :button
|
138
|
+
when :calendar
|
139
|
+
when :check_box
|
140
|
+
extend Bewildr::ControlPatterns::TogglePattern
|
141
|
+
when :combo_box
|
142
|
+
extend Bewildr::ControlTypeAdditions::ComboBoxAdditions
|
143
|
+
when :custom
|
144
|
+
build_custom_control_type
|
145
|
+
when :data_grid
|
146
|
+
extend Bewildr::ControlTypeAdditions::DataGridAdditions
|
147
|
+
when :data_item
|
148
|
+
when :document
|
149
|
+
extend Bewildr::ControlTypeAdditions::DocumentAdditions
|
150
|
+
when :edit
|
151
|
+
extend Bewildr::ControlPatterns::ValuePattern
|
152
|
+
when :group
|
153
|
+
when :header
|
154
|
+
when :header_item
|
155
|
+
when :hyperlink
|
156
|
+
extend Bewildr::ControlTypeAdditions::TextAdditions
|
157
|
+
when :image
|
158
|
+
when :list
|
159
|
+
extend Bewildr::ControlTypeAdditions::ListAdditions
|
160
|
+
when :list_item
|
161
|
+
extend Bewildr::ControlPatterns::SelectionItemPattern
|
162
|
+
when :menu
|
163
|
+
extend Bewildr::ControlTypeAdditions::MenuAdditions
|
164
|
+
when :menu_bar
|
165
|
+
when :menu_item
|
166
|
+
extend Bewildr::ControlTypeAdditions::MenuItemAdditions
|
167
|
+
when :pane
|
168
|
+
when :progress_bar
|
169
|
+
extend Bewildr::ControlPatterns::RangeValuePattern
|
170
|
+
when :radio_button
|
171
|
+
extend Bewildr::ControlPatterns::SelectionItemPattern
|
172
|
+
when :scroll_bar
|
173
|
+
when :seperator
|
174
|
+
when :slider
|
175
|
+
extend Bewildr::ControlPatterns::RangeValuePattern
|
176
|
+
when :spinner
|
177
|
+
when :split_button
|
178
|
+
when :status_bar
|
179
|
+
when :tab
|
180
|
+
extend Bewildr::ControlTypeAdditions::TabAdditions
|
181
|
+
when :tab_item
|
182
|
+
extend Bewildr::ControlPatterns::SelectionItemPattern
|
183
|
+
when :table
|
184
|
+
when :text
|
185
|
+
extend Bewildr::ControlTypeAdditions::TextAdditions
|
186
|
+
when :thumb
|
187
|
+
when :title_bar
|
188
|
+
when :tool_bar
|
189
|
+
when :tool_tip
|
190
|
+
when :tree
|
191
|
+
extend Bewildr::ControlTypeAdditions::TreeAdditions
|
192
|
+
when :tree_item
|
193
|
+
extend Bewildr::ControlTypeAdditions::TreeItemAdditions
|
194
|
+
when :window
|
195
|
+
extend Bewildr::ControlTypeAdditions::WindowAdditions
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
#TODO: this is horrible - fix it
|
200
|
+
def build_custom_control_type
|
201
|
+
@automation_element.get_supported_patterns.each do |supported_pattern|
|
202
|
+
case supported_pattern.programmatic_name.to_s
|
203
|
+
when "ValuePatternIdentifiers.Pattern" then extend Bewildr::ControlPatterns::ValuePattern
|
204
|
+
when "TableItemPatternIdentifiers.Pattern" then extend Bewildr::ControlPatterns::TableItemPattern
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
190
209
|
end
|