mk_firewatir 1.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/LICENSE +32 -0
  2. data/lib/firewatir.rb +41 -0
  3. data/lib/firewatir/container.rb +491 -0
  4. data/lib/firewatir/document.rb +239 -0
  5. data/lib/firewatir/element.rb +1369 -0
  6. data/lib/firewatir/element_collections.rb +314 -0
  7. data/lib/firewatir/elements/button.rb +15 -0
  8. data/lib/firewatir/elements/file_field.rb +29 -0
  9. data/lib/firewatir/elements/form.rb +40 -0
  10. data/lib/firewatir/elements/frame.rb +55 -0
  11. data/lib/firewatir/elements/hidden.rb +56 -0
  12. data/lib/firewatir/elements/image.rb +139 -0
  13. data/lib/firewatir/elements/input_element.rb +44 -0
  14. data/lib/firewatir/elements/link.rb +76 -0
  15. data/lib/firewatir/elements/non_control_element.rb +53 -0
  16. data/lib/firewatir/elements/non_control_elements.rb +108 -0
  17. data/lib/firewatir/elements/not_used.rb +278 -0
  18. data/lib/firewatir/elements/option.rb +131 -0
  19. data/lib/firewatir/elements/radio_check_common.rb +163 -0
  20. data/lib/firewatir/elements/select_list.rb +188 -0
  21. data/lib/firewatir/elements/table.rb +218 -0
  22. data/lib/firewatir/elements/table_cell.rb +54 -0
  23. data/lib/firewatir/elements/table_row.rb +100 -0
  24. data/lib/firewatir/elements/text_field.rb +218 -0
  25. data/lib/firewatir/exceptions.rb +10 -0
  26. data/lib/firewatir/firefox.rb +984 -0
  27. data/lib/firewatir/jssh_socket.rb +101 -0
  28. data/lib/firewatir/version.rb +5 -0
  29. data/lib/firewatir/winClicker.rb +122 -0
  30. data/lib/firewatir/x11.rb +192 -0
  31. data/unittests/attach_to_new_window_test.rb +49 -0
  32. data/unittests/bug_fixes_test.rb +195 -0
  33. data/unittests/buttons_xpath_test.rb +88 -0
  34. data/unittests/checkbox_test.rb +158 -0
  35. data/unittests/checkbox_xpath_test.rb +107 -0
  36. data/unittests/div_test.rb +275 -0
  37. data/unittests/ff_test.rb +47 -0
  38. data/unittests/filefield_test.rb +49 -0
  39. data/unittests/filefield_xpath_test.rb +35 -0
  40. data/unittests/form_test.rb +296 -0
  41. data/unittests/frame_test.rb +159 -0
  42. data/unittests/hidden_test.rb +85 -0
  43. data/unittests/hidden_xpath_test.rb +72 -0
  44. data/unittests/html/JavascriptClick.html +42 -0
  45. data/unittests/html/blankpage.html +12 -0
  46. data/unittests/html/buttons1.html +61 -0
  47. data/unittests/html/checkboxes1.html +71 -0
  48. data/unittests/html/complex_table.html +36 -0
  49. data/unittests/html/cssTest.html +42 -0
  50. data/unittests/html/div.html +72 -0
  51. data/unittests/html/div_xml.html +21 -0
  52. data/unittests/html/fileupload.html +45 -0
  53. data/unittests/html/formTest1.html +39 -0
  54. data/unittests/html/forms2.html +45 -0
  55. data/unittests/html/forms3.html +132 -0
  56. data/unittests/html/forms4.html +27 -0
  57. data/unittests/html/frame_buttons.html +4 -0
  58. data/unittests/html/frame_links.html +4 -0
  59. data/unittests/html/frame_multi.html +5 -0
  60. data/unittests/html/iframeTest.html +15 -0
  61. data/unittests/html/iframeTest1.html +14 -0
  62. data/unittests/html/iframeTest2.html +6 -0
  63. data/unittests/html/images/1.gif +0 -0
  64. data/unittests/html/images/2.GIF +0 -0
  65. data/unittests/html/images/3.GIF +0 -0
  66. data/unittests/html/images/button.jpg +0 -0
  67. data/unittests/html/images/circle.jpg +0 -0
  68. data/unittests/html/images/minus.GIF +0 -0
  69. data/unittests/html/images/originaltriangle.jpg +0 -0
  70. data/unittests/html/images/plus.gif +0 -0
  71. data/unittests/html/images/square.jpg +0 -0
  72. data/unittests/html/images/triangle.jpg +0 -0
  73. data/unittests/html/images1.html +67 -0
  74. data/unittests/html/javascriptevents.html +35 -0
  75. data/unittests/html/link_pass.html +11 -0
  76. data/unittests/html/links1.html +42 -0
  77. data/unittests/html/links2.html +11 -0
  78. data/unittests/html/modal_dialog.html +8 -0
  79. data/unittests/html/modal_dialog_launcher.html +12 -0
  80. data/unittests/html/nestedFrames.html +6 -0
  81. data/unittests/html/new_browser.html +18 -0
  82. data/unittests/html/new_browser_popup.html +8 -0
  83. data/unittests/html/pass.html +10 -0
  84. data/unittests/html/popups1.html +60 -0
  85. data/unittests/html/pre.html +28 -0
  86. data/unittests/html/radioButtons1.html +71 -0
  87. data/unittests/html/redirect.html +10 -0
  88. data/unittests/html/redirect1.html +9 -0
  89. data/unittests/html/redirect2.html +9 -0
  90. data/unittests/html/redirect3.html +9 -0
  91. data/unittests/html/select_tealeaf.html +54 -0
  92. data/unittests/html/selectboxes1.html +55 -0
  93. data/unittests/html/simple_table.html +26 -0
  94. data/unittests/html/simple_table_buttons.html +104 -0
  95. data/unittests/html/simple_table_columns.html +74 -0
  96. data/unittests/html/table1.html +165 -0
  97. data/unittests/html/tableCell_using_xpath.html +19 -0
  98. data/unittests/html/textarea.html +30 -0
  99. data/unittests/html/textfields1.html +62 -0
  100. data/unittests/html/textsearch.html +44 -0
  101. data/unittests/images_test.rb +198 -0
  102. data/unittests/images_xpath_test.rb +118 -0
  103. data/unittests/javascript_test.rb +75 -0
  104. data/unittests/links_test.rb +231 -0
  105. data/unittests/links_xpath_test.rb +79 -0
  106. data/unittests/mozilla_all_tests.rb +7 -0
  107. data/unittests/pre_test.rb +75 -0
  108. data/unittests/radios_test.rb +166 -0
  109. data/unittests/radios_xpath_test.rb +101 -0
  110. data/unittests/redirect_test.rb +41 -0
  111. data/unittests/selectbox_test.rb +142 -0
  112. data/unittests/selectbox_xpath_test.rb +129 -0
  113. data/unittests/setup.rb +29 -0
  114. data/unittests/table_test.rb +385 -0
  115. data/unittests/table_xpath_test.rb +185 -0
  116. data/unittests/textfields_test.rb +234 -0
  117. data/unittests/textfields_xpath_test.rb +113 -0
  118. metadata +208 -0
data/LICENSE ADDED
@@ -0,0 +1,32 @@
1
+ ---------------------------------------------------------------------------
2
+ Copyright (c) 2004 - 2005, Paul Rogers and Bret Pettichord
3
+ Copyright (c) 2006 - 2007, Angrez Singh
4
+ Copyright (c) 2008, Bret Pettichord
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the names Angrez Singh nor the names of contributors to
17
+ this software may be used to endorse or promote products derived from this
18
+ software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
21
+ IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ --------------------------------------------------------------------------
32
+ (based on BSD Open Source License)
@@ -0,0 +1,41 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
+
3
+ require 'socket'
4
+ require 'active_support'
5
+
6
+ require 'firewatir/exceptions'
7
+ require 'firewatir/jssh_socket'
8
+ require 'firewatir/container'
9
+ require "firewatir/element"
10
+ require "firewatir/document"
11
+
12
+ require "firewatir/elements/form"
13
+ require "firewatir/elements/frame"
14
+ require "firewatir/elements/non_control_element"
15
+ require "firewatir/elements/non_control_elements"
16
+ require "firewatir/elements/table"
17
+ require "firewatir/elements/table_row"
18
+ require "firewatir/elements/table_cell"
19
+ require "firewatir/elements/image"
20
+ require "firewatir/elements/link"
21
+ require "firewatir/elements/input_element"
22
+ require "firewatir/elements/select_list"
23
+ require "firewatir/elements/option"
24
+ require "firewatir/elements/button"
25
+ require "firewatir/elements/text_field"
26
+ require "firewatir/elements/hidden"
27
+ require "firewatir/elements/file_field"
28
+ require "firewatir/elements/radio_check_common"
29
+ require "firewatir/element_collections"
30
+
31
+ require 'watir/matches'
32
+ require 'firewatir/firefox'
33
+ require 'firewatir/version'
34
+ require 'watir'
35
+
36
+
37
+ #--
38
+ # this only has an effect if firewatir is required before anyone invokes
39
+ # Browser.new. Thus it has no effect when Browser.new itself autoloads this library.
40
+ #++
41
+ Watir::Browser.default = 'firefox'
@@ -0,0 +1,491 @@
1
+ =begin
2
+ #
3
+ # This module contains the factory methods that are used to access most html objects
4
+ #
5
+ # For example, to access a button on a web page that has the following html
6
+ # <input type = button name= 'b1' value='Click Me' onClick='javascript:doSomething()'>
7
+ #
8
+ # the following Firewatir code could be used
9
+ #
10
+ # ff.button(:name, 'b1').click
11
+ #
12
+ # or
13
+ #
14
+ # ff.button(:value, 'Click Me').to_s
15
+ #
16
+ # One can use any attribute to uniquely identify an element including the user defined attributes
17
+ # that is rendered on the HTML screen. Though, Attribute used to access an element depends on the type of element,
18
+ # attributes used frequently to address an element are listed below
19
+ #
20
+ # :index - find the item using the index in the container ( a container can be a document,
21
+ # a TableCell, a Span, a Div or a P)
22
+ # index is 1 based
23
+ # :name - find the item using the name attribute
24
+ # :id - find the item using the id attribute
25
+ # :value - find the item using the value attribute
26
+ # :caption - same as value
27
+ # :xpath - finds the item using xpath query
28
+ #
29
+ # Typical Usage
30
+ #
31
+ # ff.button(:id, 'b_1') # access the button with an ID of b_1
32
+ # ff.button(:name, 'verify_data') # access the button with a name of verify_data
33
+ # ff.button(:value, 'Login') # access the button with a value (the text displayed on the button) of Login
34
+ # ff.button(:caption, 'Login') # same as above
35
+ # ff.button(:value, /Log/) # access the button that has text matching /Log/
36
+ # ff.button(:index, 2) # access the second button on the page ( 1 based, so the first button is accessed with :index,1)
37
+ #
38
+ =end
39
+
40
+ require 'firewatir/exceptions'
41
+
42
+ module FireWatir
43
+ module Container
44
+ include FireWatir
45
+ include Watir::Exception
46
+ include JsshSocket
47
+
48
+ # IP Address of the machine where the script is to be executed. Default to localhost.
49
+ MACHINE_IP = "127.0.0.1"
50
+
51
+ # The default color for highlighting objects as they are accessed.
52
+ DEFAULT_HIGHLIGHT_COLOR = "yellow"
53
+
54
+ public
55
+ #
56
+ # Description:
57
+ # Used to access a frame element. Usually an <frame> or <iframe> HTML tag.
58
+ #
59
+ # Input:
60
+ # - how - The attribute used to identify the framet.
61
+ # - what - The value of that attribute.
62
+ # If only one parameter is supplied, "how" is by default taken as name and the
63
+ # parameter supplied becomes the value of the name attribute.
64
+ #
65
+ # Typical usage:
66
+ #
67
+ # ff.frame(:index, 1)
68
+ # ff.frame(:name , 'main_frame')
69
+ # ff.frame('main_frame') # in this case, just a name is supplied.
70
+ #
71
+ # Output:
72
+ # Frame object.
73
+ #
74
+ def frame(how, what = nil)
75
+ locate if respond_to?(:locate)
76
+ if(what == nil)
77
+ what = how
78
+ how = :name
79
+ end
80
+ Frame.new(self, how, what)
81
+ end
82
+
83
+ #
84
+ # Description:
85
+ # Used to access a form element. Usually an <form> HTML tag.
86
+ #
87
+ # Input:
88
+ # - how - The attribute used to identify the form.
89
+ # - what - The value of that attribute.
90
+ # If only one parameter is supplied, "how" is by default taken as name and the
91
+ # parameter supplied becomes the value of the name attribute.
92
+ #
93
+ # Typical usage:
94
+ #
95
+ # ff.form(:index, 1)
96
+ # ff.form(:name , 'main_form')
97
+ # ff.form('main_form') # in this case, just a name is supplied.
98
+ #
99
+ # Output:
100
+ # Form object.
101
+ #
102
+ def form(how, what=nil)
103
+ locate if respond_to?(:locate)
104
+ if(what == nil)
105
+ what = how
106
+ how = :name
107
+ end
108
+ Form.new(self, how, what)
109
+ end
110
+
111
+ #
112
+ # Description:
113
+ # Used to access a table. Usually an <table> HTML tag.
114
+ #
115
+ # Input:
116
+ # - how - The attribute used to identify the table.
117
+ # - what - The value of that attribute.
118
+ #
119
+ # Typical usage:
120
+ #
121
+ # ff.table(:index, 1) #index starts from 1.
122
+ # ff.table(:id, 'main_table')
123
+ #
124
+ # Output:
125
+ # Table object.
126
+ #
127
+ def table(how, what=nil)
128
+ locate if respond_to?(:locate)
129
+ Table.new(self, how, what)
130
+ end
131
+
132
+ #
133
+ # Description:
134
+ # Used to access a table cell. Usually an <td> HTML tag.
135
+ #
136
+ # Input:
137
+ # - how - The attribute used to identify the cell.
138
+ # - what - The value of that attribute.
139
+ #
140
+ # Typical Usage:
141
+ # ff.cell(:id, 'tb_cell')
142
+ # ff.cell(:index, 1)
143
+ #
144
+ # Output:
145
+ # TableCell Object
146
+ #
147
+ def cell(how, what=nil)
148
+ locate if respond_to?(:locate)
149
+ TableCell.new(self, how, what)
150
+ end
151
+
152
+ #
153
+ # Description:
154
+ # Used to access a table row. Usually an <tr> HTML tag.
155
+ #
156
+ # Input:
157
+ # - how - The attribute used to identify the row.
158
+ # - what - The value of that attribute.
159
+ #
160
+ # Typical Usage:
161
+ # ff.row(:id, 'tb_row')
162
+ # ff.row(:index, 1)
163
+ #
164
+ # Output:
165
+ # TableRow object
166
+ #
167
+ def row(how, what=nil)
168
+ locate if respond_to?(:locate)
169
+ TableRow.new(self, how, what)
170
+ end
171
+
172
+ #
173
+ # Description:
174
+ # Used to access a button element. Usually an <input type = "button"> HTML tag.
175
+ #
176
+ # Input:
177
+ # - how - The attribute used to identify the row.
178
+ # - what - The value of that attribute.
179
+ #
180
+ # Typical Usage:
181
+ # ff.button(:id, 'b_1') # access the button with an ID of b_1
182
+ # ff.button(:name, 'verify_data') # access the button with a name of verify_data
183
+ #
184
+ # if only a single parameter is supplied, then :value is used as 'how' and parameter supplied is used as what.
185
+ #
186
+ # ff.button('Click Me') # access the button with a value of Click Me
187
+ #
188
+ # Output:
189
+ # Button element.
190
+ #
191
+ def button(how, what=nil)
192
+ locate if respond_to?(:locate)
193
+ if what.nil? && String === how
194
+ what = how
195
+ how = :value
196
+ end
197
+ Button.new(self, how, what)
198
+ end
199
+
200
+ #
201
+ # Description:
202
+ # Used for accessing a file field. Usually an <input type = file> HTML tag.
203
+ #
204
+ # Input:
205
+ # - how - Attribute used to identify the file field element
206
+ # - what - Value of that attribute.
207
+ #
208
+ # Typical Usage:
209
+ # ff.file_field(:id, 'up_1') # access the file upload fff.d with an ID of up_1
210
+ # ff.file_field(:name, 'upload') # access the file upload fff.d with a name of upload
211
+ #
212
+ # Output:
213
+ # FileField object
214
+ #
215
+ def file_field(how, what = nil)
216
+ locate if respond_to?(:locate)
217
+ FileField.new(self, how, what)
218
+ end
219
+
220
+ #
221
+ # Description:
222
+ # Used for accessing a text field. Usually an <input type = text> HTML tag. or a text area - a <textarea> tag
223
+ #
224
+ # Input:
225
+ # - how - Attribute used to identify the text field element.
226
+ # - what - Value of that attribute.
227
+ #
228
+ # Typical Usage:
229
+ #
230
+ # ff.text_field(:id, 'user_name') # access the text field with an ID of user_name
231
+ # ff.text_field(:name, 'address') # access the text field with a name of address
232
+ #
233
+ # Output:
234
+ # TextField object.
235
+ #
236
+ def text_field(how, what = nil)
237
+ locate if respond_to?(:locate)
238
+ TextField.new(self, how, what)
239
+ end
240
+
241
+ #
242
+ # Description:
243
+ # Used to access hidden field element. Usually an <input type = hidden> HTML tag
244
+ #
245
+ # Input:
246
+ # - how - Attribute used to identify the hidden element.
247
+ # - what - Value of that attribute.
248
+ #
249
+ # Typical Usage:
250
+ #
251
+ # ff.hidden(:id, 'user_name') # access the hidden element with an ID of user_name
252
+ # ff.hidden(:name, 'address') # access the hidden element with a name of address
253
+ #
254
+ # Output:
255
+ # Hidden object.
256
+ #
257
+ def hidden(how, what=nil)
258
+ locate if respond_to?(:locate)
259
+ return Hidden.new(self, how, what)
260
+ end
261
+
262
+ #
263
+ # Description:
264
+ # Used to access select list element. Usually an <select> HTML tag.
265
+ #
266
+ # Input:
267
+ # - how - Attribute used to identify the select element.
268
+ # - what - Value of that attribute.
269
+ #
270
+ # Typical Usage:
271
+ #
272
+ # ff.select_list(:id, 'user_name') # access the select list with an ID of user_name
273
+ # ff.select_list(:name, 'address') # access the select list with a name of address
274
+ #
275
+ # Output:
276
+ # Select List object.
277
+ #
278
+ def select_list(how, what=nil)
279
+ locate if respond_to?(:locate)
280
+ return SelectList.new(self, how, what)
281
+ end
282
+
283
+ #
284
+ # Description:
285
+ # Used to access checkbox element. Usually an <input type = checkbox> HTML tag.
286
+ #
287
+ # Input:
288
+ # - how - Attribute used to identify the check box element.
289
+ # - what - Value of that attribute.
290
+ #
291
+ # Typical Usage:
292
+ #
293
+ # ff.checkbox(:id, 'user_name') # access the checkbox element with an ID of user_name
294
+ # ff.checkbox(:name, 'address') # access the checkbox element with a name of address
295
+ # In many instances, checkboxes on an html page have the same name, but are identified by different values. An example is shown next.
296
+ #
297
+ # <input type = checkbox name = email_frequency value = 'daily' > Daily Email
298
+ # <input type = checkbox name = email_frequency value = 'Weekly'> Weekly Email
299
+ # <input type = checkbox name = email_frequency value = 'monthly'>Monthly Email
300
+ #
301
+ # FireWatir can access these using the following:
302
+ #
303
+ # ff.checkbox(:id, 'day_to_send' , 'monday' ) # access the check box with an id of day_to_send and a value of monday
304
+ # ff.checkbox(:name ,'email_frequency', 'weekly') # access the check box with a name of email_frequency and a value of 'weekly'
305
+ #
306
+ # Output:
307
+ # Checkbox object.
308
+ #
309
+ def checkbox(how, what=nil, value = nil)
310
+ locate if respond_to?(:locate)
311
+ return CheckBox.new(self, how, what, value)
312
+ end
313
+
314
+ #
315
+ # Description:
316
+ # Used to access radio button element. Usually an <input type = radio> HTML tag.
317
+ #
318
+ # Input:
319
+ # - how - Attribute used to identify the radio button element.
320
+ # - what - Value of that attribute.
321
+ #
322
+ # Typical Usage:
323
+ #
324
+ # ff.radio(:id, 'user_name') # access the radio button element with an ID of user_name
325
+ # ff.radio(:name, 'address') # access the radio button element with a name of address
326
+ # In many instances, radio buttons on an html page have the same name, but are identified by different values. An example is shown next.
327
+ #
328
+ # <input type = radio name = email_frequency value = 'daily' > Daily Email
329
+ # <input type = radio name = email_frequency value = 'Weekly'> Weekly Email
330
+ # <input type = radio name = email_frequency value = 'monthly'>Monthly Email
331
+ #
332
+ # FireWatir can access these using the following:
333
+ #
334
+ # ff.radio(:id, 'day_to_send' , 'monday' ) # access the radio button with an id of day_to_send and a value of monday
335
+ # ff.radio(:name ,'email_frequency', 'weekly') # access the radio button with a name of email_frequency and a value of 'weekly'
336
+ #
337
+ # Output:
338
+ # Radio button object.
339
+ #
340
+ def radio(how, what=nil, value = nil)
341
+ locate if respond_to?(:locate)
342
+ return Radio.new(self, how, what, value)
343
+ end
344
+
345
+ #
346
+ # Description:
347
+ # Used to access link element. Usually an <a> HTML tag.
348
+ #
349
+ # Input:
350
+ # - how - Attribute used to identify the link element.
351
+ # - what - Value of that attribute.
352
+ #
353
+ # Typical Usage:
354
+ #
355
+ # ff.link(:id, 'user_name') # access the link element with an ID of user_name
356
+ # ff.link(:name, 'address') # access the link element with a name of address
357
+ #
358
+ # Output:
359
+ # Link object.
360
+ #
361
+ def link(how, what=nil)
362
+ locate if respond_to?(:locate)
363
+ return Link.new(self, how, what)
364
+ end
365
+
366
+ #
367
+ # Description:
368
+ # Used to access image element. Usually an <img> HTML tag.
369
+ #
370
+ # Input:
371
+ # - how - Attribute used to identify the image element.
372
+ # - what - Value of that attribute.
373
+ #
374
+ # Typical Usage:
375
+ #
376
+ # ff.image(:id, 'user_name') # access the image element with an ID of user_name
377
+ # ff.image(:name, 'address') # access the image element with a name of address
378
+ #
379
+ # Output:
380
+ # Image object.
381
+ #
382
+ def image(how, what = nil)
383
+ locate if respond_to?(:locate)
384
+ Image.new(self, how, what)
385
+ end
386
+
387
+
388
+ #
389
+ # Description:
390
+ # Used to access a definition list element - a <dl> HTML tag.
391
+ #
392
+ # Input:
393
+ # - how - Attribute used to identify the definition list element.
394
+ # - what - Value of that attribute.
395
+ #
396
+ # Typical Usage:
397
+ #
398
+ # ff.dl(:id, 'user_name') # access the dl element with an ID of user_name
399
+ # ff.dl(:title, 'address') # access the dl element with a title of address
400
+ #
401
+ # Returns:
402
+ # Dl object.
403
+ #
404
+ def dl(how, what = nil)
405
+ locate if respond_to?(:locate)
406
+ Dl.new(self, how, what)
407
+ end
408
+
409
+ #
410
+ # Description:
411
+ # Used to access a definition term element - a <dt> HTML tag.
412
+ #
413
+ # Input:
414
+ # - how - Attribute used to identify the image element.
415
+ # - what - Value of that attribute.
416
+ #
417
+ # Typical Usage:
418
+ #
419
+ # ff.dt(:id, 'user_name') # access the dt element with an ID of user_name
420
+ # ff.dt(:title, 'address') # access the dt element with a title of address
421
+ #
422
+ # Returns:
423
+ # Dt object.
424
+ #
425
+ def dt(how, what = nil)
426
+ locate if respond_to?(:locate)
427
+ Dt.new(self, how, what)
428
+ end
429
+
430
+ #
431
+ # Description:
432
+ # Used to access a definition description element - a <dd> HTML tag.
433
+ #
434
+ # Input:
435
+ # - how - Attribute used to identify the image element.
436
+ # - what - Value of that attribute.
437
+ #
438
+ # Typical Usage:
439
+ #
440
+ # ff.dd(:id, 'user_name') # access the dd element with an ID of user_name
441
+ # ff.dd(:title, 'address') # access the dd element with a title of address
442
+ #
443
+ # Returns:
444
+ # Dd object.
445
+ #
446
+ def dd(how, what = nil)
447
+ locate if respond_to?(:locate)
448
+ Dd.new(self, how, what)
449
+ end
450
+
451
+ # Description:
452
+ # Searching for Page Elements. Not for external consumption.
453
+ #
454
+ # def ole_inner_elements
455
+ # return document.body.all
456
+ # end
457
+ # private :ole_inner_elements
458
+
459
+
460
+ #
461
+ # Description:
462
+ # This method shows the available objects on the current page.
463
+ # This is usually only used for debugging or writing new test scripts.
464
+ # This is a nice feature to help find out what HTML objects are on a page
465
+ # when developing a test case using FireWatir.
466
+ #
467
+ # Typical Usage:
468
+ # ff.show_all_objects
469
+ #
470
+ # Output:
471
+ # Prints all the available elements on the page.
472
+ #
473
+ def show_all_objects
474
+ puts "-----------Objects in the current context-------------"
475
+ locate if respond_to?(:locate)
476
+ elements = Document.new(self).all
477
+ puts elements.length
478
+ elements.each do |n|
479
+ puts n.tagName
480
+ puts n.to_s
481
+ puts "------------------------------------------"
482
+ end
483
+ puts "Total number of objects in the current context : #{elements.length}"
484
+ return elements
485
+ # Test the index access.
486
+ # puts doc[35].to_s
487
+ end
488
+
489
+ end
490
+ end # module
491
+