celerity_thingista 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +9 -0
- data/.gitmodules +3 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/LICENSE +278 -0
- data/README.rdoc +84 -0
- data/Rakefile +15 -0
- data/benchmark/bm_2000_spans.rb +48 -0
- data/benchmark/bm_digg.rb +26 -0
- data/benchmark/bm_google_images.rb +36 -0
- data/benchmark/bm_input_locator.rb +69 -0
- data/benchmark/bm_text_input.rb +19 -0
- data/benchmark/loader.rb +14 -0
- data/celerity.gemspec +26 -0
- data/lib/celerity.rb +75 -0
- data/lib/celerity/browser.rb +924 -0
- data/lib/celerity/clickable_element.rb +73 -0
- data/lib/celerity/collections.rb +164 -0
- data/lib/celerity/container.rb +802 -0
- data/lib/celerity/default_viewer.rb +14 -0
- data/lib/celerity/disabled_element.rb +40 -0
- data/lib/celerity/element.rb +314 -0
- data/lib/celerity/element_collection.rb +115 -0
- data/lib/celerity/element_locator.rb +164 -0
- data/lib/celerity/elements/button.rb +54 -0
- data/lib/celerity/elements/file_field.rb +29 -0
- data/lib/celerity/elements/form.rb +22 -0
- data/lib/celerity/elements/frame.rb +86 -0
- data/lib/celerity/elements/image.rb +89 -0
- data/lib/celerity/elements/label.rb +16 -0
- data/lib/celerity/elements/link.rb +43 -0
- data/lib/celerity/elements/meta.rb +14 -0
- data/lib/celerity/elements/non_control_elements.rb +124 -0
- data/lib/celerity/elements/option.rb +38 -0
- data/lib/celerity/elements/radio_check.rb +114 -0
- data/lib/celerity/elements/select_list.rb +146 -0
- data/lib/celerity/elements/table.rb +154 -0
- data/lib/celerity/elements/table_cell.rb +36 -0
- data/lib/celerity/elements/table_elements.rb +42 -0
- data/lib/celerity/elements/table_row.rb +54 -0
- data/lib/celerity/elements/text_field.rb +168 -0
- data/lib/celerity/exception.rb +83 -0
- data/lib/celerity/htmlunit.rb +64 -0
- data/lib/celerity/htmlunit/commons-codec-1.7.jar +0 -0
- data/lib/celerity/htmlunit/commons-collections-3.2.1.jar +0 -0
- data/lib/celerity/htmlunit/commons-io-2.4.jar +0 -0
- data/lib/celerity/htmlunit/commons-lang3-3.1.jar +0 -0
- data/lib/celerity/htmlunit/commons-logging-1.1.1.jar +0 -0
- data/lib/celerity/htmlunit/cssparser-0.9.9.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-2.12.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.12.jar +0 -0
- data/lib/celerity/htmlunit/httpclient-4.2.3.jar +0 -0
- data/lib/celerity/htmlunit/httpcore-4.2.2.jar +0 -0
- data/lib/celerity/htmlunit/httpmime-4.2.3.jar +0 -0
- data/lib/celerity/htmlunit/jetty-http-8.1.9.v20130131.jar +0 -0
- data/lib/celerity/htmlunit/jetty-io-8.1.9.v20130131.jar +0 -0
- data/lib/celerity/htmlunit/jetty-util-8.1.9.v20130131.jar +0 -0
- data/lib/celerity/htmlunit/jetty-websocket-8.1.9.v20130131.jar +0 -0
- data/lib/celerity/htmlunit/nekohtml-1.9.18.jar +0 -0
- data/lib/celerity/htmlunit/sac-1.3.jar +0 -0
- data/lib/celerity/htmlunit/serializer-2.7.1.jar +0 -0
- data/lib/celerity/htmlunit/xalan-2.7.1.jar +0 -0
- data/lib/celerity/htmlunit/xercesImpl-2.10.0.jar +0 -0
- data/lib/celerity/htmlunit/xml-apis-1.4.01.jar +0 -0
- data/lib/celerity/identifier.rb +28 -0
- data/lib/celerity/ignoring_web_connection.rb +15 -0
- data/lib/celerity/input_element.rb +25 -0
- data/lib/celerity/javascript_debugger.rb +32 -0
- data/lib/celerity/listener.rb +143 -0
- data/lib/celerity/resources/no_viewer.png +0 -0
- data/lib/celerity/short_inspect.rb +29 -0
- data/lib/celerity/util.rb +129 -0
- data/lib/celerity/version.rb +3 -0
- data/lib/celerity/viewer_connection.rb +89 -0
- data/lib/celerity/watir_compatibility.rb +70 -0
- data/lib/celerity/xpath_support.rb +50 -0
- data/spec/browser_authentication_spec.rb +16 -0
- data/spec/browser_spec.rb +439 -0
- data/spec/button_spec.rb +24 -0
- data/spec/clickable_element_spec.rb +39 -0
- data/spec/default_viewer_spec.rb +23 -0
- data/spec/element_spec.rb +77 -0
- data/spec/filefield_spec.rb +18 -0
- data/spec/htmlunit_spec.rb +63 -0
- data/spec/implementation.rb +7 -0
- data/spec/index_offset_spec.rb +24 -0
- data/spec/link_spec.rb +16 -0
- data/spec/listener_spec.rb +142 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/table_spec.rb +41 -0
- data/spec/watir_compatibility_spec.rb +32 -0
- data/tasks/benchmark.rake +4 -0
- data/tasks/check.rake +24 -0
- data/tasks/clean.rake +3 -0
- data/tasks/fix.rake +25 -0
- data/tasks/jar.rake +55 -0
- data/tasks/rdoc.rake +4 -0
- data/tasks/snapshot.rake +25 -0
- data/tasks/spec.rake +27 -0
- data/tasks/website.rake +10 -0
- data/tasks/yard.rake +16 -0
- data/website/benchmarks.html +237 -0
- data/website/css/color.css +153 -0
- data/website/css/hacks.css +3 -0
- data/website/css/layout.css +179 -0
- data/website/css/screen.css +5 -0
- data/website/css/textmate.css +226 -0
- data/website/css/typography.css +72 -0
- data/website/gfx/body_bg.gif +0 -0
- data/website/gfx/button_bg.jpg +0 -0
- data/website/gfx/header_bg.jpg +0 -0
- data/website/gfx/header_left.jpg +0 -0
- data/website/gfx/header_right.jpg +0 -0
- data/website/gfx/nav_bg.jpg +0 -0
- data/website/index.html +125 -0
- data/website/yard/index.html +1 -0
- metadata +246 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
module Celerity
|
2
|
+
module ClickableElement
|
3
|
+
|
4
|
+
#
|
5
|
+
# click the element
|
6
|
+
#
|
7
|
+
|
8
|
+
def click
|
9
|
+
assert_exists_and_enabled
|
10
|
+
rescue_status_code_exception { @object.click }
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# double click the element (Celerity only)
|
15
|
+
#
|
16
|
+
|
17
|
+
def double_click
|
18
|
+
assert_exists_and_enabled
|
19
|
+
rescue_status_code_exception { @object.dblClick }
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# right click the element (Celerity only)
|
24
|
+
#
|
25
|
+
|
26
|
+
def right_click
|
27
|
+
assert_exists_and_enabled
|
28
|
+
rescue_status_code_exception { @object.rightClick }
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Click the element and return a new Browser instance with the resulting page.
|
33
|
+
# This is useful for elements that trigger popups when clicked.
|
34
|
+
#
|
35
|
+
# @return [Celerity::Browser]
|
36
|
+
#
|
37
|
+
|
38
|
+
def click_and_attach
|
39
|
+
assert_exists_and_enabled
|
40
|
+
browser = Browser.new(@browser.options.dup)
|
41
|
+
browser.webclient.set_cookie_manager(
|
42
|
+
@browser.webclient.get_cookie_manager
|
43
|
+
) # hirobumi: we do want cookies as well.
|
44
|
+
|
45
|
+
@browser.disable_event_listener do
|
46
|
+
rescue_status_code_exception { browser.page = @object.click }
|
47
|
+
end
|
48
|
+
|
49
|
+
browser
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Click the element and just return the content as IO. Current page stays unchanged.
|
54
|
+
# This can be used to download content that normally isn't rendered in a browser.
|
55
|
+
#
|
56
|
+
# @return [IO]
|
57
|
+
#
|
58
|
+
|
59
|
+
def download
|
60
|
+
assert_exists_and_enabled
|
61
|
+
@browser.disable_event_listener do
|
62
|
+
@object.click.getWebResponse.getContentAsStream.to_io
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def assert_exists_and_enabled
|
69
|
+
assert_exists
|
70
|
+
assert_enabled if respond_to?(:assert_enabled)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
module Celerity
|
2
|
+
|
3
|
+
class Frames < ElementCollection
|
4
|
+
def element_class; Frame; end
|
5
|
+
end
|
6
|
+
|
7
|
+
class Buttons < ElementCollection
|
8
|
+
def element_class; Button; end
|
9
|
+
end
|
10
|
+
|
11
|
+
class FileFields < ElementCollection
|
12
|
+
def element_class; FileField; end
|
13
|
+
end
|
14
|
+
|
15
|
+
class CheckBoxes < ElementCollection
|
16
|
+
def element_class; CheckBox; end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Radios < ElementCollection
|
20
|
+
def element_class; Radio; end
|
21
|
+
end
|
22
|
+
|
23
|
+
class SelectLists < ElementCollection
|
24
|
+
def element_class; SelectList; end
|
25
|
+
end
|
26
|
+
|
27
|
+
class Links < ElementCollection
|
28
|
+
def element_class; Link; end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Uls < ElementCollection
|
32
|
+
def element_class; Ul; end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Ols < ElementCollection
|
36
|
+
def element_class; Ol; end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Lis < ElementCollection
|
40
|
+
def element_class; Li; end
|
41
|
+
end
|
42
|
+
|
43
|
+
class Dds < ElementCollection
|
44
|
+
def element_class; Dd; end
|
45
|
+
end
|
46
|
+
|
47
|
+
class Dls < ElementCollection
|
48
|
+
def element_class; Dl; end
|
49
|
+
end
|
50
|
+
|
51
|
+
class Dts < ElementCollection
|
52
|
+
def element_class; Dt; end
|
53
|
+
end
|
54
|
+
|
55
|
+
class Ems < ElementCollection
|
56
|
+
def element_class; Em; end
|
57
|
+
end
|
58
|
+
|
59
|
+
class Maps < ElementCollection
|
60
|
+
def element_class; Map; end
|
61
|
+
end
|
62
|
+
|
63
|
+
class Areas < ElementCollection
|
64
|
+
def element_class; Area; end
|
65
|
+
end
|
66
|
+
|
67
|
+
class Images < ElementCollection
|
68
|
+
def element_class; Image; end
|
69
|
+
end
|
70
|
+
|
71
|
+
class TextFields < ElementCollection
|
72
|
+
def element_class; TextField; end
|
73
|
+
end
|
74
|
+
|
75
|
+
class Hiddens < ElementCollection
|
76
|
+
def element_class; Hidden; end
|
77
|
+
end
|
78
|
+
|
79
|
+
class Tables < ElementCollection
|
80
|
+
def element_class; Table; end
|
81
|
+
end
|
82
|
+
|
83
|
+
class TableHeaders < ElementCollection
|
84
|
+
def element_class; TableHeader; end
|
85
|
+
end
|
86
|
+
class TableBodies < ElementCollection
|
87
|
+
def element_class; TableBody; end
|
88
|
+
end
|
89
|
+
class TableFooters < ElementCollection
|
90
|
+
def element_class; TableFooter; end
|
91
|
+
end
|
92
|
+
|
93
|
+
class TableRows < ElementCollection
|
94
|
+
def element_class; TableRow; end
|
95
|
+
end
|
96
|
+
|
97
|
+
class TableCells < ElementCollection
|
98
|
+
def element_class; TableCell; end
|
99
|
+
end
|
100
|
+
|
101
|
+
class Labels < ElementCollection
|
102
|
+
def element_class; Label; end
|
103
|
+
end
|
104
|
+
|
105
|
+
class Pres < ElementCollection
|
106
|
+
def element_class; Pre; end
|
107
|
+
end
|
108
|
+
|
109
|
+
class Ps < ElementCollection
|
110
|
+
def element_class; P; end
|
111
|
+
end
|
112
|
+
|
113
|
+
class Spans < ElementCollection
|
114
|
+
def element_class; Span; end
|
115
|
+
end
|
116
|
+
|
117
|
+
class Strongs < ElementCollection
|
118
|
+
def element_class; Strong; end
|
119
|
+
end
|
120
|
+
|
121
|
+
class Divs < ElementCollection
|
122
|
+
def element_class; Div; end
|
123
|
+
end
|
124
|
+
|
125
|
+
class Forms < ElementCollection
|
126
|
+
def element_class; Form; end
|
127
|
+
end
|
128
|
+
|
129
|
+
class Options < ElementCollection
|
130
|
+
def element_class; Option; end
|
131
|
+
end
|
132
|
+
|
133
|
+
class Metas < ElementCollection
|
134
|
+
def element_class; Meta; end
|
135
|
+
end
|
136
|
+
|
137
|
+
class H1s < ElementCollection
|
138
|
+
def element_class; H1; end
|
139
|
+
end
|
140
|
+
class H2s < ElementCollection
|
141
|
+
def element_class; H2; end
|
142
|
+
end
|
143
|
+
class H3s < ElementCollection
|
144
|
+
def element_class; H3; end
|
145
|
+
end
|
146
|
+
class H4s < ElementCollection
|
147
|
+
def element_class; H4; end
|
148
|
+
end
|
149
|
+
class H5s < ElementCollection
|
150
|
+
def element_class; H5; end
|
151
|
+
end
|
152
|
+
class H6s < ElementCollection
|
153
|
+
def element_class; H6; end
|
154
|
+
end
|
155
|
+
|
156
|
+
class Inses < ElementCollection
|
157
|
+
def element_class; Ins; end
|
158
|
+
end
|
159
|
+
|
160
|
+
class Dels < ElementCollection
|
161
|
+
def element_class; Del; end
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
@@ -0,0 +1,802 @@
|
|
1
|
+
module Celerity
|
2
|
+
|
3
|
+
#
|
4
|
+
# This class contains methods for accessing elements inside a container,
|
5
|
+
# usually the Browser object, meaning the current page.
|
6
|
+
# The most common syntax is
|
7
|
+
# browser.elem(:attribute, 'value')
|
8
|
+
#
|
9
|
+
# Note that the element is located lazily, so no exceptions will be raised
|
10
|
+
# if the element doesn't exist until you call a method on the resulting object.
|
11
|
+
# To do this you would normally use Element#exists? or an action method,
|
12
|
+
# like ClickableElement#click.
|
13
|
+
# You can also pass in a hash:
|
14
|
+
#
|
15
|
+
# browser.link(:index => 1).click
|
16
|
+
#
|
17
|
+
# All elements support multiple attributes identification using the
|
18
|
+
# hash syntax (though this might not always be compatible with Watir):
|
19
|
+
#
|
20
|
+
# browser.span(:class_name => 'product', :index => 5).text
|
21
|
+
#
|
22
|
+
# Checkboxes and radio buttons support a special three-argument syntax:
|
23
|
+
#
|
24
|
+
# browser.check_box(:name, 'a_name', '1234').set
|
25
|
+
#
|
26
|
+
# You can also get all the elements of a certain type by using the plural form (@see Celerity::ElementCollection):
|
27
|
+
#
|
28
|
+
# browser.links # => #<Celerity::Links:0x7a1c2da2 ...>
|
29
|
+
#
|
30
|
+
|
31
|
+
module Container
|
32
|
+
include Celerity::Exception
|
33
|
+
include Celerity::ShortInspect
|
34
|
+
|
35
|
+
# Points back to the Browser instance that contains this element
|
36
|
+
attr_reader :browser
|
37
|
+
|
38
|
+
#
|
39
|
+
# Check if the element contains the given text.
|
40
|
+
#
|
41
|
+
# @param [String, Regexp] expected_text The text to look for.
|
42
|
+
# @return [Fixnum, nil] The index of the matched text, or nil if it doesn't match.
|
43
|
+
#
|
44
|
+
|
45
|
+
def contains_text(expected_text)
|
46
|
+
assert_exists
|
47
|
+
return nil unless respond_to? :text
|
48
|
+
|
49
|
+
case expected_text
|
50
|
+
when Regexp
|
51
|
+
text() =~ expected_text
|
52
|
+
when String
|
53
|
+
text().index(expected_text)
|
54
|
+
else
|
55
|
+
raise TypeError, "expected String or Regexp, got #{expected_text.inspect}:#{expected_text.class}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# Override inspect for readability
|
61
|
+
#
|
62
|
+
|
63
|
+
def inspect
|
64
|
+
short_inspect :include => %w[@conditions @object]
|
65
|
+
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# Used internally to update the container object.
|
69
|
+
# @api private
|
70
|
+
#
|
71
|
+
|
72
|
+
def container=(container)
|
73
|
+
@container = container
|
74
|
+
@browser = container.browser
|
75
|
+
container
|
76
|
+
end
|
77
|
+
|
78
|
+
#--
|
79
|
+
# below methods sorted alphabetically
|
80
|
+
#++
|
81
|
+
|
82
|
+
#
|
83
|
+
# @return [Celerity::Area]
|
84
|
+
#
|
85
|
+
|
86
|
+
def area(*args)
|
87
|
+
Area.new(self, *args)
|
88
|
+
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# @return [Celerity::Areas]
|
92
|
+
#
|
93
|
+
|
94
|
+
def areas
|
95
|
+
Areas.new(self)
|
96
|
+
end
|
97
|
+
|
98
|
+
#
|
99
|
+
# @return [Celerity::Button]
|
100
|
+
#
|
101
|
+
|
102
|
+
def button(*args)
|
103
|
+
Button.new(self, *args)
|
104
|
+
end
|
105
|
+
|
106
|
+
#
|
107
|
+
# @return [Celerity::Buttons]
|
108
|
+
#
|
109
|
+
|
110
|
+
def buttons
|
111
|
+
Buttons.new(self)
|
112
|
+
end
|
113
|
+
|
114
|
+
#
|
115
|
+
# @return [Celerity::TableCell]
|
116
|
+
#
|
117
|
+
|
118
|
+
def cell(*args)
|
119
|
+
TableCell.new(self, *args)
|
120
|
+
end
|
121
|
+
alias_method :td, :cell
|
122
|
+
|
123
|
+
#
|
124
|
+
# @return [Celerity::TableCells]
|
125
|
+
#
|
126
|
+
|
127
|
+
def cells
|
128
|
+
TableCells.new(self)
|
129
|
+
end
|
130
|
+
alias_method :tds, :cells
|
131
|
+
|
132
|
+
#
|
133
|
+
# Since finding checkboxes by value is very common, you can use this shorthand:
|
134
|
+
#
|
135
|
+
# browser.check_box(:name, 'a_name', '1234').set
|
136
|
+
#
|
137
|
+
# or
|
138
|
+
#
|
139
|
+
# browser.check_box(:name => 'a_name', :value => '1234').set
|
140
|
+
#
|
141
|
+
# @return [Celerity::CheckBox]
|
142
|
+
#
|
143
|
+
|
144
|
+
def check_box(*args)
|
145
|
+
CheckBox.new(self, *args)
|
146
|
+
end
|
147
|
+
|
148
|
+
#
|
149
|
+
# @return [Celerity::CheckBoxes]
|
150
|
+
#
|
151
|
+
|
152
|
+
def checkboxes
|
153
|
+
CheckBoxes.new(self)
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# @return [Celerity::Dd]
|
158
|
+
#
|
159
|
+
|
160
|
+
def dd(*args)
|
161
|
+
Dd.new(self, *args)
|
162
|
+
end
|
163
|
+
|
164
|
+
#
|
165
|
+
# @return [Celerity::Dds]
|
166
|
+
#
|
167
|
+
|
168
|
+
def dds
|
169
|
+
Dds.new(self)
|
170
|
+
end
|
171
|
+
|
172
|
+
#
|
173
|
+
# @return [Celerity::Del]
|
174
|
+
#
|
175
|
+
|
176
|
+
def del(*args)
|
177
|
+
Del.new(self, *args)
|
178
|
+
end
|
179
|
+
|
180
|
+
#
|
181
|
+
# @return [Celerity::Dels]
|
182
|
+
#
|
183
|
+
|
184
|
+
def dels
|
185
|
+
Dels.new(self)
|
186
|
+
end
|
187
|
+
|
188
|
+
#
|
189
|
+
# @return [Celerity::Div]
|
190
|
+
#
|
191
|
+
|
192
|
+
def div(*args)
|
193
|
+
Div.new(self, *args)
|
194
|
+
end
|
195
|
+
|
196
|
+
#
|
197
|
+
# @return [Celerity::Divs]
|
198
|
+
#
|
199
|
+
|
200
|
+
def divs
|
201
|
+
Divs.new(self)
|
202
|
+
end
|
203
|
+
|
204
|
+
#
|
205
|
+
# @return [Celerity::Dl]
|
206
|
+
#
|
207
|
+
|
208
|
+
def dl(*args)
|
209
|
+
Dl.new(self, *args)
|
210
|
+
end
|
211
|
+
|
212
|
+
#
|
213
|
+
# @return [Celerity::Dls]
|
214
|
+
#
|
215
|
+
|
216
|
+
def dls
|
217
|
+
Dls.new(self)
|
218
|
+
end
|
219
|
+
|
220
|
+
#
|
221
|
+
# @return [Celerity::Dt]
|
222
|
+
#
|
223
|
+
|
224
|
+
def dt(*args)
|
225
|
+
Dt.new(self, *args)
|
226
|
+
end
|
227
|
+
|
228
|
+
#
|
229
|
+
# @return [Celerity::Dts]
|
230
|
+
#
|
231
|
+
|
232
|
+
def dts
|
233
|
+
Dts.new(self)
|
234
|
+
end
|
235
|
+
|
236
|
+
#
|
237
|
+
# @return [Celerity::Em]
|
238
|
+
#
|
239
|
+
|
240
|
+
def em(*args)
|
241
|
+
Em.new(self, *args)
|
242
|
+
end
|
243
|
+
|
244
|
+
#
|
245
|
+
# @return [Celerity::Ems]
|
246
|
+
#
|
247
|
+
|
248
|
+
def ems
|
249
|
+
Ems.new(self)
|
250
|
+
end
|
251
|
+
|
252
|
+
#
|
253
|
+
# @return [Celerity::FileField]
|
254
|
+
#
|
255
|
+
|
256
|
+
def file_field(*args)
|
257
|
+
FileField.new(self, *args)
|
258
|
+
end
|
259
|
+
|
260
|
+
#
|
261
|
+
# @return [Celerity::FileFields]
|
262
|
+
#
|
263
|
+
|
264
|
+
def file_fields
|
265
|
+
FileFields.new(self)
|
266
|
+
end
|
267
|
+
|
268
|
+
#
|
269
|
+
# @return [Celerity::Form]
|
270
|
+
#
|
271
|
+
|
272
|
+
def form(*args)
|
273
|
+
Form.new(self, *args)
|
274
|
+
end
|
275
|
+
|
276
|
+
#
|
277
|
+
# @return [Celerity::Forms]
|
278
|
+
#
|
279
|
+
|
280
|
+
def forms
|
281
|
+
Forms.new(self)
|
282
|
+
end
|
283
|
+
|
284
|
+
#
|
285
|
+
# @return [Celerity::Frame]
|
286
|
+
#
|
287
|
+
|
288
|
+
def frame(*args)
|
289
|
+
Frame.new(self, *args)
|
290
|
+
end
|
291
|
+
|
292
|
+
#
|
293
|
+
# @return [Celerity::Frames]
|
294
|
+
#
|
295
|
+
|
296
|
+
def frames
|
297
|
+
Frames.new(self)
|
298
|
+
end
|
299
|
+
|
300
|
+
#
|
301
|
+
# @return [Celerity::H1]
|
302
|
+
#
|
303
|
+
|
304
|
+
def h1(*args)
|
305
|
+
H1.new(self, *args)
|
306
|
+
end
|
307
|
+
|
308
|
+
#
|
309
|
+
# @return [Celerity::H1s]
|
310
|
+
#
|
311
|
+
|
312
|
+
def h1s
|
313
|
+
H1s.new(self)
|
314
|
+
end
|
315
|
+
|
316
|
+
#
|
317
|
+
# @return [Celerity::H2]
|
318
|
+
#
|
319
|
+
|
320
|
+
def h2(*args)
|
321
|
+
H2.new(self, *args)
|
322
|
+
end
|
323
|
+
|
324
|
+
#
|
325
|
+
# @return [Celerity::H2s]
|
326
|
+
#
|
327
|
+
|
328
|
+
def h2s
|
329
|
+
H2s.new(self)
|
330
|
+
end
|
331
|
+
|
332
|
+
#
|
333
|
+
# @return [Celerity::H3]
|
334
|
+
#
|
335
|
+
|
336
|
+
def h3(*args)
|
337
|
+
H3.new(self, *args)
|
338
|
+
end
|
339
|
+
|
340
|
+
#
|
341
|
+
# @return [Celerity::H3s]
|
342
|
+
#
|
343
|
+
|
344
|
+
def h3s
|
345
|
+
H3s.new(self)
|
346
|
+
end
|
347
|
+
|
348
|
+
#
|
349
|
+
# @return [Celerity::H4]
|
350
|
+
#
|
351
|
+
|
352
|
+
def h4(*args)
|
353
|
+
H4.new(self, *args)
|
354
|
+
end
|
355
|
+
|
356
|
+
#
|
357
|
+
# @return [Celerity::H4s]
|
358
|
+
#
|
359
|
+
|
360
|
+
def h4s
|
361
|
+
H4s.new(self)
|
362
|
+
end
|
363
|
+
|
364
|
+
#
|
365
|
+
# @return [Celerity::H5]
|
366
|
+
#
|
367
|
+
|
368
|
+
def h5(*args)
|
369
|
+
H5.new(self, *args)
|
370
|
+
end
|
371
|
+
|
372
|
+
#
|
373
|
+
# @return [Celerity::H5s]
|
374
|
+
#
|
375
|
+
|
376
|
+
def h5s
|
377
|
+
H5s.new(self)
|
378
|
+
end
|
379
|
+
|
380
|
+
#
|
381
|
+
# @return [Celerity::H6]
|
382
|
+
#
|
383
|
+
|
384
|
+
def h6(*args)
|
385
|
+
H6.new(self, *args)
|
386
|
+
end
|
387
|
+
|
388
|
+
#
|
389
|
+
# @return [Celerity::H6s]
|
390
|
+
#
|
391
|
+
|
392
|
+
def h6s
|
393
|
+
H6s.new(self)
|
394
|
+
end
|
395
|
+
|
396
|
+
#
|
397
|
+
# @return [Celerity::Hidden]
|
398
|
+
#
|
399
|
+
|
400
|
+
def hidden(*args)
|
401
|
+
Hidden.new(self, *args)
|
402
|
+
end
|
403
|
+
|
404
|
+
#
|
405
|
+
# @return [Celerity::Hiddens]
|
406
|
+
#
|
407
|
+
|
408
|
+
def hiddens
|
409
|
+
Hiddens.new(self)
|
410
|
+
end
|
411
|
+
|
412
|
+
#
|
413
|
+
# @return [Celerity::Ins]
|
414
|
+
#
|
415
|
+
|
416
|
+
def ins(*args)
|
417
|
+
Ins.new(self, *args)
|
418
|
+
end
|
419
|
+
|
420
|
+
#
|
421
|
+
# @return [Celerity::Inses]
|
422
|
+
#
|
423
|
+
|
424
|
+
def inses(*args)
|
425
|
+
Inses.new(self, *args)
|
426
|
+
end
|
427
|
+
|
428
|
+
|
429
|
+
#
|
430
|
+
# @return [Celerity::Image]
|
431
|
+
#
|
432
|
+
|
433
|
+
def image(*args)
|
434
|
+
Image.new(self, *args)
|
435
|
+
end
|
436
|
+
|
437
|
+
#
|
438
|
+
# @return [Celerity::Images]
|
439
|
+
#
|
440
|
+
|
441
|
+
def images
|
442
|
+
Images.new(self)
|
443
|
+
end
|
444
|
+
|
445
|
+
#
|
446
|
+
# @return [Celerity::Label]
|
447
|
+
#
|
448
|
+
|
449
|
+
def label(*args)
|
450
|
+
Label.new(self, *args)
|
451
|
+
end
|
452
|
+
|
453
|
+
#
|
454
|
+
# @return [Celerity::Labels]
|
455
|
+
#
|
456
|
+
|
457
|
+
def labels
|
458
|
+
Labels.new(self)
|
459
|
+
end
|
460
|
+
|
461
|
+
#
|
462
|
+
# @return [Celerity::Li]
|
463
|
+
#
|
464
|
+
|
465
|
+
def li(*args)
|
466
|
+
Li.new(self, *args)
|
467
|
+
end
|
468
|
+
|
469
|
+
#
|
470
|
+
# @return [Celerity::Lis]
|
471
|
+
#
|
472
|
+
|
473
|
+
def lis
|
474
|
+
Lis.new(self)
|
475
|
+
end
|
476
|
+
|
477
|
+
#
|
478
|
+
# @return [Celerity::Link]
|
479
|
+
#
|
480
|
+
|
481
|
+
def link(*args)
|
482
|
+
Link.new(self, *args)
|
483
|
+
end
|
484
|
+
alias_method :a, :link
|
485
|
+
|
486
|
+
#
|
487
|
+
# @return [Celerity::Links]
|
488
|
+
#
|
489
|
+
|
490
|
+
def links
|
491
|
+
Links.new(self)
|
492
|
+
end
|
493
|
+
alias_method :as, :links
|
494
|
+
|
495
|
+
#
|
496
|
+
# @return [Celerity::Map]
|
497
|
+
#
|
498
|
+
|
499
|
+
def map(*args)
|
500
|
+
Map.new(self, *args)
|
501
|
+
end
|
502
|
+
|
503
|
+
#
|
504
|
+
# @return [Celerity::Maps]
|
505
|
+
#
|
506
|
+
|
507
|
+
def maps
|
508
|
+
Maps.new(self)
|
509
|
+
end
|
510
|
+
|
511
|
+
#
|
512
|
+
# @return [Celerity::Meta]
|
513
|
+
#
|
514
|
+
|
515
|
+
def meta(*args)
|
516
|
+
Meta.new(self, *args)
|
517
|
+
end
|
518
|
+
|
519
|
+
#
|
520
|
+
# @return [Celerity::Metas]
|
521
|
+
#
|
522
|
+
|
523
|
+
def metas(*args)
|
524
|
+
Metas.new(self, *args)
|
525
|
+
end
|
526
|
+
|
527
|
+
#
|
528
|
+
# @return [Celerity::Ol]
|
529
|
+
#
|
530
|
+
|
531
|
+
def ol(*args)
|
532
|
+
Ol.new(self, *args)
|
533
|
+
end
|
534
|
+
|
535
|
+
#
|
536
|
+
# @return [Celerity::Ols]
|
537
|
+
#
|
538
|
+
|
539
|
+
def ols
|
540
|
+
Ols.new(self)
|
541
|
+
end
|
542
|
+
|
543
|
+
#
|
544
|
+
# @return [Celerity::Option]
|
545
|
+
#
|
546
|
+
|
547
|
+
def option(*args)
|
548
|
+
Option.new(self, *args)
|
549
|
+
end
|
550
|
+
|
551
|
+
#
|
552
|
+
# @return [Celerity::P]
|
553
|
+
#
|
554
|
+
|
555
|
+
def p(*args)
|
556
|
+
P.new(self, *args)
|
557
|
+
end
|
558
|
+
|
559
|
+
#
|
560
|
+
# @return [Celerity::Ps]
|
561
|
+
#
|
562
|
+
|
563
|
+
def ps
|
564
|
+
Ps.new(self)
|
565
|
+
end
|
566
|
+
|
567
|
+
#
|
568
|
+
# @return [Celerity::Pre]
|
569
|
+
#
|
570
|
+
|
571
|
+
def pre(*args)
|
572
|
+
Pre.new(self, *args)
|
573
|
+
end
|
574
|
+
|
575
|
+
#
|
576
|
+
# @return [Celerity::Pres]
|
577
|
+
#
|
578
|
+
|
579
|
+
def pres
|
580
|
+
Pres.new(self)
|
581
|
+
end
|
582
|
+
|
583
|
+
#
|
584
|
+
# Since finding radios by value is very common, you can use this shorthand:
|
585
|
+
#
|
586
|
+
# browser.radio(:name, 'a_name', '1234').set
|
587
|
+
#
|
588
|
+
# or
|
589
|
+
#
|
590
|
+
# browser.radio(:name => 'a_name', :value => '1234').set
|
591
|
+
#
|
592
|
+
# @return [Celerity::Radio]
|
593
|
+
#
|
594
|
+
|
595
|
+
def radio(*args)
|
596
|
+
Radio.new(self, *args)
|
597
|
+
end
|
598
|
+
|
599
|
+
#
|
600
|
+
# @return [Celerity::Radios]
|
601
|
+
#
|
602
|
+
|
603
|
+
def radios
|
604
|
+
Radios.new(self)
|
605
|
+
end
|
606
|
+
|
607
|
+
#
|
608
|
+
# @return [Celerity::TableRow]
|
609
|
+
#
|
610
|
+
|
611
|
+
def row(*args)
|
612
|
+
TableRow.new(self, *args)
|
613
|
+
end
|
614
|
+
|
615
|
+
#
|
616
|
+
# @return [Celerity::TableRows]
|
617
|
+
#
|
618
|
+
|
619
|
+
def rows
|
620
|
+
TableRows.new(self)
|
621
|
+
end
|
622
|
+
|
623
|
+
#
|
624
|
+
# @return [Celerity::SelectList]
|
625
|
+
#
|
626
|
+
|
627
|
+
def select_list(*args)
|
628
|
+
SelectList.new(self, *args)
|
629
|
+
end
|
630
|
+
|
631
|
+
#
|
632
|
+
# @return [Celerity::SelectLists]
|
633
|
+
#
|
634
|
+
|
635
|
+
def select_lists
|
636
|
+
SelectLists.new(self)
|
637
|
+
end
|
638
|
+
|
639
|
+
#
|
640
|
+
# @return [Celerity::Span]
|
641
|
+
#
|
642
|
+
|
643
|
+
def span(*args)
|
644
|
+
Span.new(self, *args)
|
645
|
+
end
|
646
|
+
|
647
|
+
#
|
648
|
+
# @return [Celerity::Spans]
|
649
|
+
#
|
650
|
+
|
651
|
+
def spans
|
652
|
+
Spans.new(self)
|
653
|
+
end
|
654
|
+
|
655
|
+
#
|
656
|
+
# @return [Celerity::Spans]
|
657
|
+
#
|
658
|
+
|
659
|
+
def strong(*args)
|
660
|
+
Strong.new(self, *args)
|
661
|
+
end
|
662
|
+
|
663
|
+
#
|
664
|
+
# @return [Celerity::Strongs]
|
665
|
+
#
|
666
|
+
|
667
|
+
def strongs
|
668
|
+
Strongs.new(self)
|
669
|
+
end
|
670
|
+
|
671
|
+
#
|
672
|
+
# @return [Celerity::Table]
|
673
|
+
#
|
674
|
+
|
675
|
+
def table(*args)
|
676
|
+
Table.new(self, *args)
|
677
|
+
end
|
678
|
+
|
679
|
+
#
|
680
|
+
# @return [Celerity::Tables]
|
681
|
+
#
|
682
|
+
|
683
|
+
def tables
|
684
|
+
Tables.new(self)
|
685
|
+
end
|
686
|
+
|
687
|
+
#
|
688
|
+
# @return [Celerity::TableBody]
|
689
|
+
#
|
690
|
+
|
691
|
+
def tbody(*args)
|
692
|
+
TableBody.new(self, *args)
|
693
|
+
end
|
694
|
+
|
695
|
+
#
|
696
|
+
# @return [Celerity::TableBodies]
|
697
|
+
#
|
698
|
+
|
699
|
+
def tbodies
|
700
|
+
TableBodies.new(self)
|
701
|
+
end
|
702
|
+
|
703
|
+
#
|
704
|
+
# @return [Celerity::TextField]
|
705
|
+
#
|
706
|
+
|
707
|
+
def text_field(*args)
|
708
|
+
TextField.new(self, *args)
|
709
|
+
end
|
710
|
+
|
711
|
+
#
|
712
|
+
# @return [Celerity::TextFields]
|
713
|
+
#
|
714
|
+
|
715
|
+
def text_fields
|
716
|
+
TextFields.new(self)
|
717
|
+
end
|
718
|
+
|
719
|
+
#
|
720
|
+
# @return [Celerity::TableFooter]
|
721
|
+
#
|
722
|
+
|
723
|
+
def tfoot(*args)
|
724
|
+
TableFooter.new(self, *args)
|
725
|
+
end
|
726
|
+
|
727
|
+
#
|
728
|
+
# @return [Celerity::TableFooters]
|
729
|
+
#
|
730
|
+
|
731
|
+
def tfoots
|
732
|
+
TableFooters.new(self)
|
733
|
+
end
|
734
|
+
alias_method :tfeet, :tfoots # :-)
|
735
|
+
|
736
|
+
#
|
737
|
+
# Watir's cells() won't find <th> elements.
|
738
|
+
# This is a workaround.
|
739
|
+
#
|
740
|
+
# @return [Celerity::Th]
|
741
|
+
#
|
742
|
+
|
743
|
+
def th(*args)
|
744
|
+
Th.new(self, *args)
|
745
|
+
end
|
746
|
+
|
747
|
+
#
|
748
|
+
# FIXME: implement or change api,
|
749
|
+
# @see th
|
750
|
+
#
|
751
|
+
|
752
|
+
def ths
|
753
|
+
raise NotImplementedError
|
754
|
+
end
|
755
|
+
|
756
|
+
#
|
757
|
+
# @return [Celerity::TableHeader]
|
758
|
+
#
|
759
|
+
|
760
|
+
def thead(*args)
|
761
|
+
TableHeader.new(self, *args)
|
762
|
+
end
|
763
|
+
|
764
|
+
#
|
765
|
+
# @return [Celerity::TableHeaders]
|
766
|
+
#
|
767
|
+
|
768
|
+
def theads
|
769
|
+
TableHeaders.new(self)
|
770
|
+
end
|
771
|
+
|
772
|
+
#
|
773
|
+
# @return [Celerity::Ul]
|
774
|
+
#
|
775
|
+
|
776
|
+
def ul(*args)
|
777
|
+
Ul.new(self, *args)
|
778
|
+
end
|
779
|
+
|
780
|
+
#
|
781
|
+
# @return [Celerity::Uls]
|
782
|
+
#
|
783
|
+
|
784
|
+
def uls
|
785
|
+
Uls.new(self)
|
786
|
+
end
|
787
|
+
|
788
|
+
private
|
789
|
+
|
790
|
+
#
|
791
|
+
# Rescues HtmlUnit::FailingHttpStatusCodeException and re-raises as
|
792
|
+
# Celerity::NavigationException to avoid the huge JRuby backtrace
|
793
|
+
#
|
794
|
+
|
795
|
+
def rescue_status_code_exception(&blk)
|
796
|
+
yield
|
797
|
+
rescue HtmlUnit::FailingHttpStatusCodeException => e
|
798
|
+
raise NavigationException, e.message, caller
|
799
|
+
end
|
800
|
+
|
801
|
+
end # Container
|
802
|
+
end # Celerity
|