drnic-celerity 0.0.6.17

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.
Files changed (230) hide show
  1. data/History.txt +75 -0
  2. data/License.txt +621 -0
  3. data/Manifest.txt +229 -0
  4. data/README.rdoc +78 -0
  5. data/Rakefile +25 -0
  6. data/benchmark/bm_2000_spans.rb +48 -0
  7. data/benchmark/bm_digg.rb +26 -0
  8. data/benchmark/bm_google_images.rb +36 -0
  9. data/benchmark/bm_input_locator.rb +69 -0
  10. data/benchmark/bm_text_input.rb +19 -0
  11. data/benchmark/loader.rb +14 -0
  12. data/celerity.gemspec +40 -0
  13. data/lib/celerity.rb +77 -0
  14. data/lib/celerity/browser.rb +888 -0
  15. data/lib/celerity/clickable_element.rb +73 -0
  16. data/lib/celerity/collections.rb +156 -0
  17. data/lib/celerity/container.rb +779 -0
  18. data/lib/celerity/default_viewer.rb +14 -0
  19. data/lib/celerity/disabled_element.rb +40 -0
  20. data/lib/celerity/element.rb +314 -0
  21. data/lib/celerity/element_collection.rb +107 -0
  22. data/lib/celerity/element_locator.rb +177 -0
  23. data/lib/celerity/elements/button.rb +45 -0
  24. data/lib/celerity/elements/file_field.rb +29 -0
  25. data/lib/celerity/elements/form.rb +23 -0
  26. data/lib/celerity/elements/frame.rb +77 -0
  27. data/lib/celerity/elements/image.rb +76 -0
  28. data/lib/celerity/elements/label.rb +11 -0
  29. data/lib/celerity/elements/link.rb +30 -0
  30. data/lib/celerity/elements/meta.rb +7 -0
  31. data/lib/celerity/elements/non_control_elements.rb +106 -0
  32. data/lib/celerity/elements/option.rb +32 -0
  33. data/lib/celerity/elements/radio_check.rb +115 -0
  34. data/lib/celerity/elements/select_list.rb +142 -0
  35. data/lib/celerity/elements/table.rb +144 -0
  36. data/lib/celerity/elements/table_cell.rb +29 -0
  37. data/lib/celerity/elements/table_elements.rb +42 -0
  38. data/lib/celerity/elements/table_row.rb +48 -0
  39. data/lib/celerity/elements/text_field.rb +169 -0
  40. data/lib/celerity/exception.rb +83 -0
  41. data/lib/celerity/htmlunit.rb +65 -0
  42. data/lib/celerity/htmlunit/commons-codec-1.4.jar +0 -0
  43. data/lib/celerity/htmlunit/commons-collections-3.2.1.jar +0 -0
  44. data/lib/celerity/htmlunit/commons-httpclient-3.1.jar +0 -0
  45. data/lib/celerity/htmlunit/commons-io-1.4.jar +0 -0
  46. data/lib/celerity/htmlunit/commons-lang-2.4.jar +0 -0
  47. data/lib/celerity/htmlunit/commons-logging-1.1.1.jar +0 -0
  48. data/lib/celerity/htmlunit/cssparser-0.9.5.jar +0 -0
  49. data/lib/celerity/htmlunit/htmlunit-2.6-SNAPSHOT.jar +0 -0
  50. data/lib/celerity/htmlunit/htmlunit-core-js-2.6-SNAPSHOT.jar +0 -0
  51. data/lib/celerity/htmlunit/nekohtml-1.9.13-20090820.100833-15.jar +0 -0
  52. data/lib/celerity/htmlunit/sac-1.3.jar +0 -0
  53. data/lib/celerity/htmlunit/serializer-2.7.1.jar +0 -0
  54. data/lib/celerity/htmlunit/xalan-2.7.1.jar +0 -0
  55. data/lib/celerity/htmlunit/xercesImpl-2.9.1.jar +0 -0
  56. data/lib/celerity/htmlunit/xml-apis-1.3.04.jar +0 -0
  57. data/lib/celerity/identifier.rb +11 -0
  58. data/lib/celerity/ignoring_web_connection.rb +15 -0
  59. data/lib/celerity/input_element.rb +25 -0
  60. data/lib/celerity/listener.rb +141 -0
  61. data/lib/celerity/resources/no_viewer.png +0 -0
  62. data/lib/celerity/short_inspect.rb +20 -0
  63. data/lib/celerity/util.rb +91 -0
  64. data/lib/celerity/viewer_connection.rb +89 -0
  65. data/lib/celerity/watir_compatibility.rb +83 -0
  66. data/lib/celerity/xpath_support.rb +48 -0
  67. data/spec/browser_authentication_spec.rb +16 -0
  68. data/spec/browser_spec.rb +300 -0
  69. data/spec/clickable_element_spec.rb +39 -0
  70. data/spec/default_viewer_spec.rb +23 -0
  71. data/spec/element_spec.rb +51 -0
  72. data/spec/filefield_spec.rb +18 -0
  73. data/spec/htmlunit_spec.rb +56 -0
  74. data/spec/index_offset_spec.rb +24 -0
  75. data/spec/listener_spec.rb +142 -0
  76. data/spec/spec_helper.rb +8 -0
  77. data/tasks/benchmark.rake +4 -0
  78. data/tasks/deployment.rake +43 -0
  79. data/tasks/environment.rake +7 -0
  80. data/tasks/fix.rake +25 -0
  81. data/tasks/jar.rake +57 -0
  82. data/tasks/rdoc.rake +4 -0
  83. data/tasks/rspec.rake +43 -0
  84. data/tasks/simple_ci.rake +94 -0
  85. data/tasks/snapshot.rake +22 -0
  86. data/tasks/website.rake +17 -0
  87. data/tasks/yard.rake +9 -0
  88. data/website/benchmarks.html +237 -0
  89. data/website/css/color.css +153 -0
  90. data/website/css/hacks.css +3 -0
  91. data/website/css/layout.css +179 -0
  92. data/website/css/screen.css +5 -0
  93. data/website/css/textmate.css +226 -0
  94. data/website/css/typography.css +72 -0
  95. data/website/gfx/body_bg.gif +0 -0
  96. data/website/gfx/button_bg.jpg +0 -0
  97. data/website/gfx/header_bg.jpg +0 -0
  98. data/website/gfx/header_left.jpg +0 -0
  99. data/website/gfx/header_right.jpg +0 -0
  100. data/website/gfx/nav_bg.jpg +0 -0
  101. data/website/index.html +133 -0
  102. data/website/yard/Celerity.html +50 -0
  103. data/website/yard/Celerity/Area.html +212 -0
  104. data/website/yard/Celerity/Areas.html +103 -0
  105. data/website/yard/Celerity/Browser.html +5594 -0
  106. data/website/yard/Celerity/Button.html +312 -0
  107. data/website/yard/Celerity/Buttons.html +103 -0
  108. data/website/yard/Celerity/CheckBox.html +347 -0
  109. data/website/yard/Celerity/CheckBoxes.html +103 -0
  110. data/website/yard/Celerity/ClickableElement.html +448 -0
  111. data/website/yard/Celerity/Container.html +7676 -0
  112. data/website/yard/Celerity/Dd.html +198 -0
  113. data/website/yard/Celerity/Dds.html +103 -0
  114. data/website/yard/Celerity/DefaultViewer.html +101 -0
  115. data/website/yard/Celerity/DisabledElement.html +252 -0
  116. data/website/yard/Celerity/Div.html +198 -0
  117. data/website/yard/Celerity/Divs.html +103 -0
  118. data/website/yard/Celerity/Dl.html +198 -0
  119. data/website/yard/Celerity/Dls.html +103 -0
  120. data/website/yard/Celerity/Dt.html +198 -0
  121. data/website/yard/Celerity/Dts.html +103 -0
  122. data/website/yard/Celerity/Element.html +1703 -0
  123. data/website/yard/Celerity/ElementCollection.html +725 -0
  124. data/website/yard/Celerity/ElementLocator.html +589 -0
  125. data/website/yard/Celerity/Em.html +198 -0
  126. data/website/yard/Celerity/Ems.html +103 -0
  127. data/website/yard/Celerity/Exception.html +23 -0
  128. data/website/yard/Celerity/Exception/CelerityException.html +32 -0
  129. data/website/yard/Celerity/Exception/MissingWayOfFindingObjectException.html +32 -0
  130. data/website/yard/Celerity/Exception/NavigationException.html +33 -0
  131. data/website/yard/Celerity/Exception/NoValueFoundException.html +33 -0
  132. data/website/yard/Celerity/Exception/ObjectDisabledException.html +33 -0
  133. data/website/yard/Celerity/Exception/ObjectReadOnlyException.html +33 -0
  134. data/website/yard/Celerity/Exception/UnexpectedPageException.html +33 -0
  135. data/website/yard/Celerity/Exception/UnknownCellException.html +33 -0
  136. data/website/yard/Celerity/Exception/UnknownFormException.html +33 -0
  137. data/website/yard/Celerity/Exception/UnknownFrameException.html +33 -0
  138. data/website/yard/Celerity/Exception/UnknownObjectException.html +33 -0
  139. data/website/yard/Celerity/Exception/UnknownRowException.html +33 -0
  140. data/website/yard/Celerity/FileField.html +289 -0
  141. data/website/yard/Celerity/FileFields.html +103 -0
  142. data/website/yard/Celerity/Form.html +284 -0
  143. data/website/yard/Celerity/Forms.html +103 -0
  144. data/website/yard/Celerity/Frame.html +527 -0
  145. data/website/yard/Celerity/Frames.html +103 -0
  146. data/website/yard/Celerity/H1.html +198 -0
  147. data/website/yard/Celerity/H1s.html +103 -0
  148. data/website/yard/Celerity/H2.html +198 -0
  149. data/website/yard/Celerity/H2s.html +103 -0
  150. data/website/yard/Celerity/H3.html +198 -0
  151. data/website/yard/Celerity/H3s.html +103 -0
  152. data/website/yard/Celerity/H4.html +198 -0
  153. data/website/yard/Celerity/H4s.html +103 -0
  154. data/website/yard/Celerity/H5.html +198 -0
  155. data/website/yard/Celerity/H5s.html +103 -0
  156. data/website/yard/Celerity/H6.html +198 -0
  157. data/website/yard/Celerity/H6s.html +103 -0
  158. data/website/yard/Celerity/Hidden.html +285 -0
  159. data/website/yard/Celerity/Hiddens.html +103 -0
  160. data/website/yard/Celerity/Image.html +645 -0
  161. data/website/yard/Celerity/Images.html +103 -0
  162. data/website/yard/Celerity/InputElement.html +271 -0
  163. data/website/yard/Celerity/Label.html +210 -0
  164. data/website/yard/Celerity/Labels.html +103 -0
  165. data/website/yard/Celerity/Li.html +198 -0
  166. data/website/yard/Celerity/Link.html +295 -0
  167. data/website/yard/Celerity/Links.html +103 -0
  168. data/website/yard/Celerity/Lis.html +103 -0
  169. data/website/yard/Celerity/Listener.html +821 -0
  170. data/website/yard/Celerity/Map.html +198 -0
  171. data/website/yard/Celerity/Maps.html +103 -0
  172. data/website/yard/Celerity/Meta.html +196 -0
  173. data/website/yard/Celerity/Metas.html +103 -0
  174. data/website/yard/Celerity/MethodGenerator.html +195 -0
  175. data/website/yard/Celerity/NonControlElement.html +212 -0
  176. data/website/yard/Celerity/Ol.html +198 -0
  177. data/website/yard/Celerity/Ols.html +103 -0
  178. data/website/yard/Celerity/Option.html +348 -0
  179. data/website/yard/Celerity/Options.html +103 -0
  180. data/website/yard/Celerity/P.html +198 -0
  181. data/website/yard/Celerity/Pre.html +198 -0
  182. data/website/yard/Celerity/Pres.html +103 -0
  183. data/website/yard/Celerity/Ps.html +103 -0
  184. data/website/yard/Celerity/Radio.html +339 -0
  185. data/website/yard/Celerity/RadioCheckCommon.html +453 -0
  186. data/website/yard/Celerity/Radios.html +103 -0
  187. data/website/yard/Celerity/SelectList.html +1122 -0
  188. data/website/yard/Celerity/SelectLists.html +103 -0
  189. data/website/yard/Celerity/ShortInspect.html +108 -0
  190. data/website/yard/Celerity/Span.html +198 -0
  191. data/website/yard/Celerity/Spans.html +103 -0
  192. data/website/yard/Celerity/Strong.html +198 -0
  193. data/website/yard/Celerity/Strongs.html +103 -0
  194. data/website/yard/Celerity/Table.html +1287 -0
  195. data/website/yard/Celerity/TableBodies.html +103 -0
  196. data/website/yard/Celerity/TableBody.html +203 -0
  197. data/website/yard/Celerity/TableCell.html +279 -0
  198. data/website/yard/Celerity/TableCells.html +103 -0
  199. data/website/yard/Celerity/TableElement.html +437 -0
  200. data/website/yard/Celerity/TableFooter.html +203 -0
  201. data/website/yard/Celerity/TableFooters.html +103 -0
  202. data/website/yard/Celerity/TableHeader.html +203 -0
  203. data/website/yard/Celerity/TableHeaders.html +103 -0
  204. data/website/yard/Celerity/TableRow.html +478 -0
  205. data/website/yard/Celerity/TableRows.html +103 -0
  206. data/website/yard/Celerity/Tables.html +103 -0
  207. data/website/yard/Celerity/TextField.html +938 -0
  208. data/website/yard/Celerity/TextFields.html +103 -0
  209. data/website/yard/Celerity/Th.html +208 -0
  210. data/website/yard/Celerity/Ul.html +209 -0
  211. data/website/yard/Celerity/Uls.html +103 -0
  212. data/website/yard/Celerity/Util.html +264 -0
  213. data/website/yard/Celerity/VERSION.html +44 -0
  214. data/website/yard/HtmlUnit.html +23 -0
  215. data/website/yard/HtmlUnit/Html.html +23 -0
  216. data/website/yard/HtmlUnit/Util.html +23 -0
  217. data/website/yard/Java/ComGargoylesoftwareHtmlunitHtml/HtmlPage.html +90 -0
  218. data/website/yard/Java/JavaLang/Iterable.html +103 -0
  219. data/website/yard/Java/OrgW3cDom/NamedNodeMap.html +97 -0
  220. data/website/yard/README.txt.html +116 -0
  221. data/website/yard/String.html +103 -0
  222. data/website/yard/all-files.html +22 -0
  223. data/website/yard/all-methods.html +3276 -0
  224. data/website/yard/all-namespaces.html +258 -0
  225. data/website/yard/app.js +18 -0
  226. data/website/yard/index.html +19 -0
  227. data/website/yard/jquery.js +11 -0
  228. data/website/yard/style.css +68 -0
  229. data/website/yard/syntax_highlight.css +21 -0
  230. metadata +307 -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,156 @@
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
+ end
@@ -0,0 +1,779 @@
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
+
122
+ #
123
+ # @return [Celerity::TableCells]
124
+ #
125
+
126
+ def cells
127
+ TableCells.new(self)
128
+ end
129
+
130
+ #
131
+ # Since finding checkboxes by value is very common, you can use this shorthand:
132
+ #
133
+ # browser.check_box(:name, 'a_name', '1234').set
134
+ #
135
+ # or
136
+ #
137
+ # browser.check_box(:name => 'a_name', :value => '1234').set
138
+ #
139
+ # @return [Celerity::CheckBox]
140
+ #
141
+
142
+ def check_box(*args)
143
+ CheckBox.new(self, *args)
144
+ end
145
+
146
+ #
147
+ # @return [Celerity::CheckBoxes]
148
+ #
149
+
150
+ def checkboxes
151
+ CheckBoxes.new(self)
152
+ end
153
+
154
+ #
155
+ # @return [Celerity::Dd]
156
+ #
157
+
158
+ def dd(*args)
159
+ Dd.new(self, *args)
160
+ end
161
+
162
+ #
163
+ # @return [Celerity::Dds]
164
+ #
165
+
166
+ def dds
167
+ Dds.new(self)
168
+ end
169
+
170
+ #
171
+ # @return [Celerity::Div]
172
+ #
173
+
174
+ def div(*args)
175
+ Div.new(self, *args)
176
+ end
177
+
178
+ #
179
+ # @return [Celerity::Divs]
180
+ #
181
+
182
+ def divs
183
+ Divs.new(self)
184
+ end
185
+
186
+ #
187
+ # @return [Celerity::Dl]
188
+ #
189
+
190
+ def dl(*args)
191
+ Dl.new(self, *args)
192
+ end
193
+
194
+ #
195
+ # @return [Celerity::Dls]
196
+ #
197
+
198
+ def dls
199
+ Dls.new(self)
200
+ end
201
+
202
+ #
203
+ # @return [Celerity::Dt]
204
+ #
205
+
206
+ def dt(*args)
207
+ Dt.new(self, *args)
208
+ end
209
+
210
+ #
211
+ # @return [Celerity::Dts]
212
+ #
213
+
214
+ def dts
215
+ Dts.new(self)
216
+ end
217
+
218
+ #
219
+ # @return [Celerity::Em]
220
+ #
221
+
222
+ def em(*args)
223
+ Em.new(self, *args)
224
+ end
225
+
226
+ #
227
+ # @return [Celerity::Ems]
228
+ #
229
+
230
+ def ems
231
+ Ems.new(self)
232
+ end
233
+
234
+ #
235
+ # @return [Celerity::FileField]
236
+ #
237
+
238
+ def file_field(*args)
239
+ FileField.new(self, *args)
240
+ end
241
+
242
+ #
243
+ # @return [Celerity::FileFields]
244
+ #
245
+
246
+ def file_fields
247
+ FileFields.new(self)
248
+ end
249
+
250
+ #
251
+ # @return [Celerity::Form]
252
+ #
253
+
254
+ def form(*args)
255
+ Form.new(self, *args)
256
+ end
257
+
258
+ #
259
+ # @return [Celerity::Forms]
260
+ #
261
+
262
+ def forms
263
+ Forms.new(self)
264
+ end
265
+
266
+ #
267
+ # @return [Celerity::Frame]
268
+ #
269
+
270
+ def frame(*args)
271
+ Frame.new(self, *args)
272
+ end
273
+
274
+ #
275
+ # @return [Celerity::Frames]
276
+ #
277
+
278
+ def frames
279
+ Frames.new(self)
280
+ end
281
+
282
+ #
283
+ # @return [Celerity::H1]
284
+ #
285
+
286
+ def h1(*args)
287
+ H1.new(self, *args)
288
+ end
289
+
290
+ #
291
+ # @return [Celerity::H1s]
292
+ #
293
+
294
+ def h1s
295
+ H1s.new(self)
296
+ end
297
+
298
+ #
299
+ # @return [Celerity::H2]
300
+ #
301
+
302
+ def h2(*args)
303
+ H2.new(self, *args)
304
+ end
305
+
306
+ #
307
+ # @return [Celerity::H2s]
308
+ #
309
+
310
+ def h2s
311
+ H2s.new(self)
312
+ end
313
+
314
+ #
315
+ # @return [Celerity::H3]
316
+ #
317
+
318
+ def h3(*args)
319
+ H3.new(self, *args)
320
+ end
321
+
322
+ #
323
+ # @return [Celerity::H3s]
324
+ #
325
+
326
+ def h3s
327
+ H3s.new(self)
328
+ end
329
+
330
+ #
331
+ # @return [Celerity::H4]
332
+ #
333
+
334
+ def h4(*args)
335
+ H4.new(self, *args)
336
+ end
337
+
338
+ #
339
+ # @return [Celerity::H4s]
340
+ #
341
+
342
+ def h4s
343
+ H4s.new(self)
344
+ end
345
+
346
+ #
347
+ # @return [Celerity::H5]
348
+ #
349
+
350
+ def h5(*args)
351
+ H5.new(self, *args)
352
+ end
353
+
354
+ #
355
+ # @return [Celerity::H5s]
356
+ #
357
+
358
+ def h5s
359
+ H5s.new(self)
360
+ end
361
+
362
+ #
363
+ # @return [Celerity::H6]
364
+ #
365
+
366
+ def h6(*args)
367
+ H6.new(self, *args)
368
+ end
369
+
370
+ #
371
+ # @return [Celerity::H6s]
372
+ #
373
+
374
+ def h6s
375
+ H6s.new(self)
376
+ end
377
+
378
+ #
379
+ # @return [Celerity::Hidden]
380
+ #
381
+
382
+ def hidden(*args)
383
+ Hidden.new(self, *args)
384
+ end
385
+
386
+ #
387
+ # @return [Celerity::Hiddens]
388
+ #
389
+
390
+ def hiddens
391
+ Hiddens.new(self)
392
+ end
393
+
394
+ #
395
+ # @return [Celerity::Image]
396
+ #
397
+
398
+ def image(*args)
399
+ Image.new(self, *args)
400
+ end
401
+
402
+ #
403
+ # @return [Celerity::Images]
404
+ #
405
+
406
+ def images
407
+ Images.new(self)
408
+ end
409
+
410
+ #
411
+ # @return [Celerity::Label]
412
+ #
413
+
414
+ def label(*args)
415
+ Label.new(self, *args)
416
+ end
417
+
418
+ #
419
+ # @return [Celerity::Labels]
420
+ #
421
+
422
+ def labels
423
+ Labels.new(self)
424
+ end
425
+
426
+ #
427
+ # @return [Celerity::Li]
428
+ #
429
+
430
+ def li(*args)
431
+ Li.new(self, *args)
432
+ end
433
+
434
+ #
435
+ # @return [Celerity::Lis]
436
+ #
437
+
438
+ def lis
439
+ Lis.new(self)
440
+ end
441
+
442
+ #
443
+ # @return [Celerity::Link]
444
+ #
445
+
446
+ def link(*args)
447
+ Link.new(self, *args)
448
+ end
449
+
450
+ #
451
+ # @return [Celerity::Links]
452
+ #
453
+
454
+ def links
455
+ Links.new(self)
456
+ end
457
+
458
+ #
459
+ # @return [Celerity::Map]
460
+ #
461
+
462
+ def map(*args)
463
+ Map.new(self, *args)
464
+ end
465
+
466
+ #
467
+ # @return [Celerity::Maps]
468
+ #
469
+
470
+ def maps
471
+ Maps.new(self)
472
+ end
473
+
474
+ #
475
+ # @return [Celerity::Meta]
476
+ #
477
+
478
+ def meta(*args)
479
+ Meta.new(self, *args)
480
+ end
481
+
482
+ #
483
+ # @return [Celerity::Metas]
484
+ #
485
+
486
+ def metas(*args)
487
+ Metas.new(self, *args)
488
+ end
489
+
490
+ #
491
+ # @return [Celerity::Ol]
492
+ #
493
+
494
+ def ol(*args)
495
+ Ol.new(self, *args)
496
+ end
497
+
498
+ #
499
+ # @return [Celerity::Ols]
500
+ #
501
+
502
+ def ols
503
+ Ols.new(self)
504
+ end
505
+
506
+ #
507
+ # @return [Celerity::Option]
508
+ #
509
+
510
+ def option(*args)
511
+ Option.new(self, *args)
512
+ end
513
+
514
+ #
515
+ # @return [Celerity::P]
516
+ #
517
+
518
+ def p(*args)
519
+ P.new(self, *args)
520
+ end
521
+
522
+ #
523
+ # @return [Celerity::Ps]
524
+ #
525
+
526
+ def ps
527
+ Ps.new(self)
528
+ end
529
+
530
+ #
531
+ # @return [Celerity::Pre]
532
+ #
533
+
534
+ def pre(*args)
535
+ Pre.new(self, *args)
536
+ end
537
+
538
+ #
539
+ # @return [Celerity::Pres]
540
+ #
541
+
542
+ def pres
543
+ Pres.new(self)
544
+ end
545
+
546
+ #
547
+ # Since finding radios by value is very common, you can use this shorthand:
548
+ #
549
+ # browser.radio(:name, 'a_name', '1234').set
550
+ #
551
+ # or
552
+ #
553
+ # browser.radio(:name => 'a_name', :value => '1234').set
554
+ #
555
+ # @return [Celerity::Radio]
556
+ #
557
+
558
+ def radio(*args)
559
+ Radio.new(self, *args)
560
+ end
561
+
562
+ #
563
+ # @return [Celerity::Radios]
564
+ #
565
+
566
+ def radios
567
+ Radios.new(self)
568
+ end
569
+
570
+ #
571
+ # @return [Celerity::TableRow]
572
+ #
573
+
574
+ def row(*args)
575
+ TableRow.new(self, *args)
576
+ end
577
+
578
+ #
579
+ # @return [Celerity::TableRows]
580
+ #
581
+
582
+ def rows
583
+ TableRows.new(self)
584
+ end
585
+
586
+ #
587
+ # @return [Celerity::SelectList]
588
+ #
589
+
590
+ def select_list(*args)
591
+ SelectList.new(self, *args)
592
+ end
593
+
594
+ #
595
+ # @return [Celerity::SelectLists]
596
+ #
597
+
598
+ def select_lists
599
+ SelectLists.new(self)
600
+ end
601
+
602
+ #
603
+ # @return [Celerity::Span]
604
+ #
605
+
606
+ def span(*args)
607
+ Span.new(self, *args)
608
+ end
609
+
610
+ #
611
+ # @return [Celerity::Spans]
612
+ #
613
+
614
+ def spans
615
+ Spans.new(self)
616
+ end
617
+
618
+ #
619
+ # @return [Celerity::Spans]
620
+ #
621
+
622
+ def strong(*args)
623
+ Strong.new(self, *args)
624
+ end
625
+
626
+ #
627
+ # @return [Celerity::Strongs]
628
+ #
629
+
630
+ def strongs
631
+ Strongs.new(self)
632
+ end
633
+
634
+ #
635
+ # @return [Celerity::Table]
636
+ #
637
+
638
+ def table(*args)
639
+ Table.new(self, *args)
640
+ end
641
+
642
+ #
643
+ # @return [Celerity::Tables]
644
+ #
645
+
646
+ def tables
647
+ Tables.new(self)
648
+ end
649
+
650
+ #
651
+ # @return [Celerity::TableBody]
652
+ #
653
+
654
+ def tbody(*args)
655
+ TableBody.new(self, *args)
656
+ end
657
+
658
+ #
659
+ # @return [Celerity::TableBodies]
660
+ #
661
+
662
+ def tbodies
663
+ TableBodies.new(self)
664
+ end
665
+
666
+ #
667
+ # @return [Celerity::TextField]
668
+ #
669
+
670
+ def text_field(*args)
671
+ TextField.new(self, *args)
672
+ end
673
+
674
+ #
675
+ # @return [Celerity::TextFields]
676
+ #
677
+
678
+ def text_fields
679
+ TextFields.new(self)
680
+ end
681
+
682
+ #
683
+ # @return [Celerity::TableFooter]
684
+ #
685
+
686
+ def tfoot(*args)
687
+ TableFooter.new(self, *args)
688
+ end
689
+
690
+ #
691
+ # @return [Celerity::TableFooters]
692
+ #
693
+
694
+ def tfoots
695
+ TableFooters.new(self)
696
+ end
697
+ alias_method :tfeet, :tfoots # :-)
698
+
699
+ #
700
+ # Watir's cells() won't find <th> elements.
701
+ # This is a workaround.
702
+ #
703
+ # @return [Celerity::Th]
704
+ #
705
+
706
+ def th(*args)
707
+ Th.new(self, *args)
708
+ end
709
+
710
+ #
711
+ # FIXME: implement or change api,
712
+ # @see th
713
+ #
714
+
715
+ def ths
716
+ raise NotImplementedError
717
+ end
718
+
719
+ #
720
+ # @return [Celerity::TableHeader]
721
+ #
722
+
723
+ def thead(*args)
724
+ TableHeader.new(self, *args)
725
+ end
726
+
727
+ #
728
+ # @return [Celerity::TableHeaders]
729
+ #
730
+
731
+ def theads
732
+ TableHeaders.new(self)
733
+ end
734
+
735
+ #
736
+ # @return [Celerity::Ul]
737
+ #
738
+
739
+ def ul(*args)
740
+ Ul.new(self, *args)
741
+ end
742
+
743
+ #
744
+ # @return [Celerity::Uls]
745
+ #
746
+
747
+ def uls
748
+ Uls.new(self)
749
+ end
750
+
751
+ private
752
+
753
+ #
754
+ # Used internally.
755
+ #
756
+ # @param [String] string The string to match against.
757
+ # @param [Regexp, String, #to_s] what The match we're looking for.
758
+ # @return [Fixnum, true, false, nil]
759
+ #
760
+ # @api private
761
+ #
762
+
763
+ def matches?(string, what)
764
+ Regexp === what ? string =~ what : string == what.to_s
765
+ end
766
+
767
+ #
768
+ # Rescues HtmlUnit::FailingHttpStatusCodeException and re-raises as
769
+ # Celerity::NavigationException to avoid the huge JRuby backtrace
770
+ #
771
+
772
+ def rescue_status_code_exception(&blk)
773
+ yield
774
+ rescue HtmlUnit::FailingHttpStatusCodeException => e
775
+ raise NavigationException, e.message, caller
776
+ end
777
+
778
+ end # Container
779
+ end # Celerity