watirloo 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/.gitignore +22 -0
  2. data/History.txt +44 -0
  3. data/Manifest.txt +59 -0
  4. data/README.rdoc +94 -0
  5. data/Rakefile +68 -0
  6. data/VERSION +1 -0
  7. data/lib/watirloo/browsers.rb +73 -0
  8. data/lib/watirloo/desktop.rb +44 -0
  9. data/lib/watirloo/extension/firewatir_ducktape.rb +194 -0
  10. data/lib/watirloo/extension/object.rb +32 -0
  11. data/lib/watirloo/extension/watir_ducktape.rb +552 -0
  12. data/lib/watirloo/extension/watir_reflector.rb +83 -0
  13. data/lib/watirloo/locker.rb +85 -0
  14. data/lib/watirloo/page.rb +140 -0
  15. data/lib/watirloo.rb +16 -0
  16. data/spec/browser_spec.rb +38 -0
  17. data/spec/browser_threads_spec.rb +45 -0
  18. data/spec/checkbox_group_spec.rb +136 -0
  19. data/spec/checkbox_groups_spec.rb +55 -0
  20. data/spec/checkboxes_value_spec.rb +35 -0
  21. data/spec/desktop_spec.rb +54 -0
  22. data/spec/extra/browser_events_spec.rb +76 -0
  23. data/spec/extra/page_objects_metrics.rb +139 -0
  24. data/spec/face_mixing_spec.rb +55 -0
  25. data/spec/firewatir/attach_instance_test.rb +38 -0
  26. data/spec/firewatir/spec_results.html +263 -0
  27. data/spec/firewatir/spec_results.txt +23 -0
  28. data/spec/firewatir/spec_results_failed.txt +3 -0
  29. data/spec/html/census.html +332 -0
  30. data/spec/html/checkbox_group1.html +33 -0
  31. data/spec/html/frameset1.html +17 -0
  32. data/spec/html/labels.html +53 -0
  33. data/spec/html/no_title.html +13 -0
  34. data/spec/html/person.html +37 -0
  35. data/spec/html/radio_group.html +35 -0
  36. data/spec/html/select_lists.html +82 -0
  37. data/spec/input_element_spec.rb +51 -0
  38. data/spec/label_spec.rb +65 -0
  39. data/spec/locker_spec.rb +49 -0
  40. data/spec/page_spec.rb +91 -0
  41. data/spec/person_def_wrappers_spec.rb +40 -0
  42. data/spec/radio_group_spec.rb +95 -0
  43. data/spec/radio_groups_spec.rb +55 -0
  44. data/spec/reflector_spec.rb +82 -0
  45. data/spec/select_list_options_spec.rb +40 -0
  46. data/spec/select_lists_spec.rb +151 -0
  47. data/spec/spec_helper.rb +20 -0
  48. data/spec/spec_helper_ff.rb +5 -0
  49. data/spec/spec_helper_runner.rb +13 -0
  50. data/spec/spec_results.html +556 -0
  51. data/spec/spec_results.txt +175 -0
  52. data/spec/spec_results_failed.txt +1 -0
  53. data/spec/text_fields_spec.rb +56 -0
  54. data/watirloo.gemspec +122 -0
  55. metadata +150 -0
@@ -0,0 +1,332 @@
1
+ <!--
2
+ Document : census
3
+ -->
4
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5
+ <html>
6
+ <head>
7
+ <title>Census</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9
+ <style>
10
+ td {font-size: 11px;
11
+ background-color: #eee;}
12
+ </style>
13
+ </head>
14
+ <body>
15
+
16
+ <table id="census" width="800" cellSpacing="1" cellPadding="2" width="100%" border="0">
17
+ <tbody>
18
+ <tr>
19
+ <td class="head" colSpan="8">
20
+ Census
21
+ </td>
22
+ </tr>
23
+
24
+ <tr id="header">
25
+ <td>Emp</td>
26
+ <td>Last Name</td>
27
+ <td>First Name</td>
28
+ <td>DOB (mm/dd/yyyy)</td>
29
+ <td>Age In Years</td>
30
+ <td>Gender</td>
31
+ <td>State</td>
32
+ <td>Status</td>
33
+ </tr>
34
+
35
+ <tr id="row0">
36
+ <td><input type="checkbox" name="census_check0" value="1" />&nbsp;1</td>
37
+ <td><input maxLength="40" size="10" name="last_name0" value="" /></td>
38
+ <td><input maxLength="20" size="10" name="first_name0" value="" /></td>
39
+ <td><input maxLength="10" size="10" name="dob0" value="" /></td>
40
+ <td><input maxLength="3" size="3" name="age0" value="" /></td>
41
+ <td>
42
+ <select name="sex_cd0">
43
+ <option value=" "></option>
44
+ <option value="M">M</option>
45
+ <option value="F">F</option>
46
+ </select>
47
+ </td>
48
+
49
+ <td>
50
+ <select name="state_cd0">
51
+ <option value=""></option>
52
+ <option value="TX">Texas</option>
53
+ <option value="IL">Illinois</option>
54
+ <option value="IN">Indiana</option>
55
+ <option value="OT">Other</option>
56
+ </select>
57
+ </td>
58
+ <td>
59
+ <select name="emp_status0">
60
+ <option selected value="NO"></option><option value="FT">Employed Full Time</option>
61
+ <option value="UN">Unemployed</option>
62
+ <option value="PT">Employed Part Time</option>
63
+ <option value="RT">Retired</option></select>
64
+ </td>
65
+ </tr>
66
+
67
+ <tr id="row1">
68
+ <td><input type="checkbox" name="census_check1" value="2" />&nbsp;2</td>
69
+ <td><input maxLength="40" size="10" name="last_name1" value="" /></td>
70
+ <td><input maxLength="20" size="10" name="first_name1" value="" /></td>
71
+ <td><input maxLength="10" size="10" name="dob1" value="" /></td>
72
+ <td><input maxLength="3" size="3" name="age1" value="" /></td>
73
+ <td>
74
+ <select name="sex_cd1">
75
+ <option value=" "></option>
76
+ <option value="M">M</option>
77
+ <option value="F">F</option>
78
+ </select>
79
+ </td>
80
+
81
+ <td>
82
+ <select name="state_cd1">
83
+ <option value=""></option>
84
+ <option value="TX">Texas</option>
85
+ <option value="IL">Illinois</option>
86
+ <option value="IN">Indiana</option>
87
+ <option value="OT">Other</option>
88
+ </select>
89
+ </td>
90
+ <td>
91
+ <select name="emp_status1">
92
+ <option selected value="NO"></option>
93
+ <option value="FT">Employed Full Time</option>
94
+ <option value="UN">Unemployed</option>
95
+ <option value="PT">Employed Part Time</option>
96
+ <option value="RT">Retired</option></select>
97
+ </td>
98
+ </tr>
99
+
100
+ <tr id="row2">
101
+ <td><input type="checkbox" name="census_check2" value="3" />&nbsp;3</td>
102
+ <td><input maxLength="40" size="10" name="last_name2" value="" /></td>
103
+ <td><input maxLength="20" size="10" name="first_name2" value="" /></td>
104
+ <td><input maxLength="10" size="10" name="dob2" value="" /></td>
105
+ <td><input maxLength="3" size="3" name="age2" value="" /></td>
106
+ <td>
107
+ <select name="sex_cd2">
108
+ <option value=" "></option>
109
+ <option value="M">M</option>
110
+ <option value="F">F</option>
111
+ </select>
112
+ </td>
113
+
114
+ <td>
115
+ <select name="state_cd2">
116
+ <option value=""></option>
117
+ <option value="TX">Texas</option>
118
+ <option value="IL">Illinois</option>
119
+ <option value="IN">Indiana</option>
120
+ <option value="OT">Other</option>
121
+ </select>
122
+ </td>
123
+ <td>
124
+ <select name="emp_status2">
125
+ <option value=""></option>
126
+ <option value="FT">Employed Full Time</option>
127
+ <option value="UN">Unemployed</option>
128
+ <option value="PT">Employed Part Time</option>
129
+ <option value="RT">Retired</option></select>
130
+ </td>
131
+ </tr>
132
+
133
+ <tr id="row3">
134
+ <td><input type="checkbox" name="census_check3" value="4" />&nbsp;4</td>
135
+ <td><input maxLength="40" size="10" name="last_name3" value="" /></td>
136
+ <td><input maxLength="20" size="10" name="first_name3" value="" /></td>
137
+ <td><input maxLength="10" size="10" name="dob3" value="" /></td>
138
+ <td><input maxLength="3" size="3" name="age3" value="" /></td>
139
+ <td>
140
+ <select name="sex_cd3">
141
+ <option value=" "></option>
142
+ <option value="M">M</option>
143
+ <option value="F">F</option>
144
+ </select>
145
+ </td>
146
+
147
+ <td>
148
+ <select name="state_cd3">
149
+ <option value=""></option>
150
+ <option value="TX">Texas</option>
151
+ <option value="IL">Illinois</option>
152
+ <option value="IN">Indiana</option>
153
+ <option value="OT">Other</option>
154
+ </select>
155
+ </td>
156
+ <td>
157
+ <select name="emp_status3">
158
+ <option value=""></option><option value="FT">Employed Full Time</option>
159
+ <option value="UN">Unemployed</option>
160
+ <option value="PT">Employed Part Time</option>
161
+ <option value="RT">Retired</option></select>
162
+ </td>
163
+ </tr>
164
+
165
+ <tr id="row4">
166
+ <td><input type="checkbox" name="census_check4" value="5" />&nbsp;5</td>
167
+ <td><input maxLength="40" size="10" name="last_name4" value="" /></td>
168
+ <td><input maxLength="20" size="10" name="first_name4" value="" /></td>
169
+ <td><input maxLength="10" size="10" name="dob4" value="" /></td>
170
+ <td><input maxLength="3" size="3" name="age4" value="" /></td>
171
+ <td>
172
+ <select name="sex_cd4">
173
+ <option value=" "></option>
174
+ <option value="M">M</option>
175
+ <option value="F">F</option>
176
+ </select>
177
+ </td>
178
+
179
+ <td>
180
+ <select name="state_cd4">
181
+ <option value=""></option>
182
+ <option value="TX">Texas</option>
183
+ <option value="IL">Illinois</option>
184
+ <option value="IN">Indiana</option>
185
+ <option value="OT">Other</option>
186
+ </select>
187
+ </td>
188
+ <td>
189
+ <select name="emp_status4">
190
+ <option value=""></option><option value="FT">Employed Full Time</option>
191
+ <option value="UN">Unemployed</option>
192
+ <option value="PT">Employed Part Time</option>
193
+ <option value="RT">Retired</option></select>
194
+ </td>
195
+ </tr>
196
+
197
+ <tr id="row5">
198
+ <td><input type="checkbox" name="census_check5" value="6" />&nbsp;6</td>
199
+ <td><input maxLength="40" size="10" name="last_name5" value="" /></td>
200
+ <td><input maxLength="20" size="10" name="first_name5" value="" /></td>
201
+ <td><input maxLength="10" size="10" name="dob5" value="" /></td>
202
+ <td><input maxLength="3" size="3" name="age5" value="" /></td>
203
+ <td>
204
+ <select name="sex_cd5">
205
+ <option value=" "></option>
206
+ <option value="M">M</option>
207
+ <option value="F">F</option>
208
+ </select>
209
+ </td>
210
+
211
+ <td>
212
+ <select name="state_cd5">
213
+ <option value=""></option>
214
+ <option value="TX">Texas</option>
215
+ <option value="IL">Illinois</option>
216
+ <option value="IN">Indiana</option>
217
+ <option value="OT">Other</option>
218
+ </select>
219
+ </td>
220
+ <td>
221
+ <select name="emp_status5">
222
+ <option value=""></option><option value="FT">Employed Full Time</option>
223
+ <option value="UN">Unemployed</option>
224
+ <option value="PT">Employed Part Time</option>
225
+ <option value="RT">Retired</option></select>
226
+ </td>
227
+ </tr>
228
+
229
+
230
+ <tr id="row6">
231
+ <td><input type="checkbox" name="census_check6" value="7" />&nbsp;7</td>
232
+ <td><input maxLength="40" size="10" name="last_name6" value="" /></td>
233
+ <td><input maxLength="20" size="10" name="first_name6" value="" /></td>
234
+ <td><input maxLength="10" size="10" name="dob6" value="" /></td>
235
+ <td><input maxLength="3" size="3" name="age6" value="" /></td>
236
+ <td>
237
+ <select name="sex_cd6">
238
+ <option value=" "></option>
239
+ <option value="M">M</option>
240
+ <option value="F">F</option>
241
+ </select>
242
+ </td>
243
+
244
+ <td>
245
+ <select name="state_cd6">
246
+ <option value=""></option>
247
+ <option value="TX">Texas</option>
248
+ <option value="IL">Illinois</option>
249
+ <option value="IN">Indiana</option>
250
+ <option value="OT">Other</option>
251
+ </select>
252
+ </td>
253
+ <td>
254
+ <select name="emp_status6">
255
+ <option value=""></option><option value="FT">Employed Full Time</option>
256
+ <option value="UN">Unemployed</option>
257
+ <option value="PT">Employed Part Time</option>
258
+ <option value="RT">Retired</option></select>
259
+ </td>
260
+ </tr>
261
+
262
+ <tr id="row7">
263
+ <td><input type="checkbox" name="census_check7" value="8" />&nbsp;8</td>
264
+ <td><input maxLength="40" size="10" name="last_name7" value="" /></td>
265
+ <td><input maxLength="20" size="10" name="first_name7" value="" /></td>
266
+ <td><input maxLength="10" size="10" name="dob7" value="" /></td>
267
+ <td><input maxLength="3" size="3" name="age7" value="" /></td>
268
+ <td>
269
+ <select name="sex_cd7">
270
+ <option value=" "></option>
271
+ <option value="M">M</option>
272
+ <option value="F">F</option>
273
+ </select>
274
+ </td>
275
+
276
+ <td>
277
+ <select name="state_cd7">
278
+ <option value=""></option>
279
+ <option value="TX">Texas</option>
280
+ <option value="IL">Illinois</option>
281
+ <option value="IN">Indiana</option>
282
+ <option value="OT">Other</option>
283
+ </select>
284
+ </td>
285
+ <td>
286
+ <select name="emp_status7">
287
+ <option value=""></option><option value="FT">Employed Full Time</option>
288
+ <option value="UN">Unemployed</option>
289
+ <option value="PT">Employed Part Time</option>
290
+ <option value="RT">Retired</option></select>
291
+ </td>
292
+ </tr>
293
+
294
+ <tr id="row8">
295
+ <td><input type="checkbox" name="census_check8" value="9" />&nbsp;9</td>
296
+ <td><input maxLength="40" size="10" name="last_name8" value="" /></td>
297
+ <td><input maxLength="20" size="10" name="first_name8" value="" /></td>
298
+ <td><input maxLength="10" size="10" name="dob8" value="" /></td>
299
+ <td><input maxLength="3" size="3" name="age8" value="" /></td>
300
+ <td>
301
+ <select name="sex_cd8">
302
+ <option value=" "></option>
303
+ <option value="M">M</option>
304
+ <option value="F">F</option>
305
+ </select>
306
+ </td>
307
+
308
+ <td>
309
+ <select name="state_cd8">
310
+ <option value=""></option>
311
+ <option value="TX">Texas</option>
312
+ <option value="IL">Illinois</option>
313
+ <option value="IN">Indiana</option>
314
+ <option value="OT">Other</option>
315
+ </select>
316
+ </td>
317
+ <td>
318
+ <select name="emp_status8">
319
+ <option value=""></option><option value="FT">Employed Full Time</option>
320
+ <option value="UN">Unemployed</option>
321
+ <option value="PT">Employed Part Time</option>
322
+ <option value="RT">Retired</option></select>
323
+ </td>
324
+ </tr>
325
+
326
+
327
+ </tbody>
328
+ </table>
329
+
330
+
331
+ </body>
332
+ </html>
@@ -0,0 +1,33 @@
1
+ <!--
2
+ Document : checbox_group
3
+ -->
4
+ <!DOCtype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5
+ <html>
6
+ <head>
7
+ <title></title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9
+ </head>
10
+ <body>
11
+ <form name="forma">
12
+ <h3>Pets CheckboxGroup. Each has value. Acts like MultiSelectList. none, one ore more items can be checked.</h3>
13
+ <input name="pets" type="checkbox" value="cat">Cat<br />
14
+ <input name="pets" type="checkbox" value="dog">Dog<br />
15
+ <input name="pets" type="checkbox" value="zook">Zook<br />
16
+ <input name="pets" type="checkbox" value="zebra">Zebra<br />
17
+ <input name="pets" type="checkbox" value="wumpa">Wumpa<br />
18
+ <h3>Single CheckboxToggle Only. Acts like RadioGroup on/off switch.</h3>
19
+ <input name="singleIndicator" type="checkbox">Toggle Me<br />
20
+ </form>
21
+ <form name="formb">
22
+ <h3>Petsa (with last names) CheckboxGroup. Each has value. Acts like MultiSelectList. none, one ore more items can be checked.</h3>
23
+ <input name="petsa" type="checkbox" value="cata">Cat Mleczus<br />
24
+ <input name="petsa" type="checkbox" value="doga">Dog Wuffski<br />
25
+ <input name="petsa" type="checkbox" value="zooka">Zook ZookaZeeka<br />
26
+ <input name="petsa" type="checkbox" value="zebraa">Zebra Pregowana<br />
27
+ <input name="petsa" type="checkbox" value="wumpaa">Wumpa OompaPlumpa<br />
28
+ <h3>Single CheckboxToggle Only. Acts like RadioGroup on/off switch.</h3>
29
+ <input name="singleIndicatora" type="checkbox">Toggle Me Me<br />
30
+ </form>
31
+
32
+ </body>
33
+ </html>
@@ -0,0 +1,17 @@
1
+ <!--
2
+ frames
3
+ -->
4
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
5
+ <html>
6
+ <head>
7
+ <title>frameset with 2 frames</title>
8
+ </head>
9
+ <frameset cols="50%,50%">
10
+ <frame name="census_frame" src="census.html" />
11
+ <frame name="person_frame" src="person.html" />
12
+ </frameset>
13
+ <NOFRAMES>
14
+ <p>frameset document</p>
15
+ </NOFRAMES>
16
+
17
+ </html>
@@ -0,0 +1,53 @@
1
+ <!--
2
+ Document : labels
3
+ http://www.w3.org/TR/html401/interact/forms.html#edef-LABEL
4
+ -->
5
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
6
+ <html>
7
+ <head>
8
+ <title>Labels</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
10
+ </head>
11
+ <body>
12
+ <h3> About Labels </h3>
13
+ <p><a href="http://www.w3.org/TR/html401/interact/forms.html#edef-LABEL">html401 label spec</a> --
14
+ label atribute :for holds a value of element :id it is bound to. Click on label sets the element with specified :id
15
+ <br />
16
+ checkbox, text_field, radiobutton do not have explicit labels like buttons
17
+ </p>
18
+
19
+ <h3>Implicit label wraps text_field without for attribute. Click does not transfer focus to control</h3>
20
+ <p>not a standard usage for label</p>
21
+ <form id="wrap_without_for"action="" method="get">
22
+ <p>
23
+ <label>First Name<input type="text" name="fn"></label>
24
+ </p>
25
+ <p>
26
+ <label><input type="text" name="ln">Last Name</label>
27
+ </p>
28
+ </form>
29
+
30
+ <h3>Explicit Label For Item with Id. Click transfers focus to control associated by id</h3>
31
+ <form id="label_for_id"action="" method="get">
32
+ <p>
33
+ <label for="first_nm">FirstName For</label>
34
+ <input type="text" name="firstname" id="first_nm">
35
+
36
+ <label for="last_nm">LastName For</label>
37
+ <input type="text" name="lastname" id="last_nm">
38
+
39
+ <br />
40
+
41
+ <label for="gender_code">Select Gender</label>
42
+ <select name="sex_cd" id="gender_code">
43
+ <option value="" selected></option>
44
+ <option value="M">Male</option>
45
+ <option value="F">Female</option>
46
+ </select>
47
+
48
+
49
+ </p>
50
+ </form>
51
+
52
+ </body>
53
+ </html>
@@ -0,0 +1,13 @@
1
+ <!--
2
+ no title set for window
3
+ -->
4
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5
+ <html>
6
+ <head>
7
+ <title></title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9
+ </head>
10
+ <body>
11
+ <div id="notitle">THIS IE HAS NO TITLE</div>
12
+ </body>
13
+ </html>
@@ -0,0 +1,37 @@
1
+ <!--
2
+ Document : person
3
+ -->
4
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5
+ <html>
6
+ <head>
7
+ <title>Person</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9
+ </head>
10
+ <body>
11
+ <div id="personPanel">
12
+ <h2>Person Info</h2>
13
+ <p id="tagline">Some info about a person</p>
14
+ <form id="person" name="person" action="person.fake.page" method="post">
15
+ <br />Last Name: <input maxLength="45" size="25" name="last_nm" value="Begoodnuffski" />
16
+ <br />First Name: <input maxLength="20" size="10" name="first_nm" value="Joanney" />
17
+ <br />Gender: <select name="sex_cd">
18
+ <option value=" "></option>
19
+ <option value="M" selected>M</option>
20
+ <option value="F">F</option>
21
+ </select>
22
+ <br />Date Of Birth: <input maxLength="10" size="10" name="dob" value="05/09/1964" />
23
+ <br />Street Address<input maxLength="45" size="45" name="addr1" value="1600 Transylavnia Ave." />
24
+ <br />Has the following pets:
25
+ <SELECT name="pets" MULTIPLE SIZE=4>
26
+ <OPTION VALUE="o1">cat
27
+ <OPTION VALUE="o2">dog
28
+ <OPTION VALUE="o3">zook
29
+ <OPTION VALUE="o4">zebra
30
+ <OPTION VALUE="o5">wumpa
31
+
32
+ </SELECT>
33
+
34
+ </form>
35
+ </div>
36
+ </body>
37
+ </html>
@@ -0,0 +1,35 @@
1
+ <!-- Document : radio_group --> <!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ <title>radio_groups</title>
5
+ <meta http-equiv="Content-Type" content="text/html;
6
+ charset=UTF-8"> </head>
7
+ <body>
8
+ <h3>wanna eat what?</h3>
9
+ <form name="radios2" action="/"> <table border="0">
10
+ <tbody>
11
+ <tr><td><input type="radio" name="food" value="hotdog" /></td><td>Hothund</td></tr>
12
+ <tr><td><input type="radio" name="food" value="burger" checked /></td><td>Burgier</td></tr>
13
+ <tr><td><input type="radio" name="food" value="tofu" /></td><td>Tofoo</td></tr>
14
+ </tbody></table>
15
+ </form>
16
+ <h3>wannaa eata whata?</h3>
17
+ <form name="radios3" action="/"> <table border="0">
18
+ <tbody>
19
+ <tr><td><input type="radio" name="fooda" value="hotdoga" /></td><td>Hothunda</td></tr>
20
+ <tr><td><input type="radio" name="fooda" value="burgera" /></td><td>Burgiera</td></tr>
21
+ <tr><td><input type="radio" name="fooda" value="tofua" checked/></td><td>Tofooa</td></tr>
22
+ </tbody></table>
23
+ </form>
24
+
25
+ <h3>fooda same name but scoped to diff form name</h3>
26
+ <form name="radios4" action="/"> <table border="0">
27
+ <tbody>
28
+ <tr><td><input type="radio" name="fooda" value="hotdoga_t" /></td><td>Hothunda_t</td></tr>
29
+ <tr><td><input type="radio" name="fooda" value="burgera_t" /></td><td>Burgiera_t</td></tr>
30
+ <tr><td><input type="radio" name="fooda" value="tofua_t" checked/></td><td>Tofooa_t</td></tr>
31
+ </tbody></table>
32
+ </form>
33
+
34
+ </body>
35
+ </html>
@@ -0,0 +1,82 @@
1
+ <!--
2
+ Document : select_lists
3
+ -->
4
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5
+ <html>
6
+ <head>
7
+ <title>select lists</title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9
+ </head>
10
+ <body>
11
+ <form id="selectors" action="none.page" method="post">
12
+ <h3>multiple select</h3>
13
+ <select name="animals" multiple size=4>
14
+ <option value="o1">cat</option>
15
+ <option value="o2">dog</option>
16
+ <option value="o3">zook</option>
17
+ <option value="o4">zebra</option>
18
+ <option value="o5">wumpa</option>
19
+ </select>
20
+
21
+ <h3>single select</h3>
22
+ <select name="sex_cd">
23
+ <option value="" selected></option>
24
+ <option value="m">M</option>
25
+ <option value="f">F</option>
26
+ </select>
27
+
28
+ <h3>single select with no hidden values in options</h3>
29
+ <p>if value attribute is not set <a href="http://www.w3.org/TR/html401/interact/forms.html#edef-OPTGROUP">
30
+ the initial value is set to the contents of the option element.</a></p>
31
+ <select name="bubel">
32
+ <option selected></option>
33
+ <option>foobel</option>
34
+ <option>barbel</option>
35
+ <option>bazbel</option>
36
+ <option>chuchu</option>
37
+ </select>
38
+ </form>
39
+
40
+ <h3>select with 3 optgroups</h3>
41
+
42
+ <form id="optgroups" action="none.page" method="post">
43
+ <p></p>
44
+ <select name="cars" multiple size="10">
45
+ <option selected label="none" value="none">none</option>
46
+ <OPTGROUP label="economy">
47
+ <option label="yug" value="yugo">Yugo</option>
48
+ <option label="tra" value="trabi">Trabant</option>
49
+ </OPTGROUP>
50
+ <OPTGROUP label="midsize">
51
+ <option label="zig" value="ziguli">Ziguli Sport</option>
52
+ <option label="syr" value="syrenka">Syrenka 4 Door</option>
53
+ </OPTGROUP>
54
+ <OPTGROUP label="fullsize">
55
+ <option label="vol" value="volga">Czarna Volga</option>
56
+ <option label="lim" value="limo">Limozyna</option>
57
+ </OPTGROUP>
58
+ </select>
59
+
60
+ <p></p>
61
+ <select name="shoes">
62
+ <option selected label="none" value="none">none</option>
63
+ <OPTGROUP label="Beachware">
64
+ <option>YoFeet</option>
65
+ <option>Plestyk</option>
66
+ </OPTGROUP>
67
+ <OPTGROUP label="Runware">
68
+ <option>Adidasy</option>
69
+ <option>Najkee</option>
70
+ </OPTGROUP>
71
+ <OPTGROUP label="Cubicleware">
72
+ <option>Zocks</option>
73
+ <option>Bamboshki</option>
74
+ </OPTGROUP>
75
+ </select>
76
+
77
+
78
+ </form>
79
+
80
+
81
+ </body>
82
+ </html>
@@ -0,0 +1,51 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ module Watir
4
+ module Container
5
+
6
+ def input_label(label)
7
+ what = self.label(:text, label).for
8
+ raise "label for attribute is blank" if what == ""
9
+ input_id(what)
10
+ end
11
+
12
+ # If user knowns the Label that has a for attribute pointing to an element we can access that element by
13
+ # input_element(:lable, 'Text Of Label')
14
+ def input_id(what)
15
+ raise "provide a String for Id" unless what.kind_of?(String)
16
+ # for input_element('bla') convention to (:id,'bla')
17
+ mystery_element = self.document.getElementById(what)
18
+ raise 'Element not found' unless mystery_element
19
+ mystery_type = mystery_element.invoke('type')
20
+ return text_field(:id, what) if TextField::INPUT_TYPES.include? mystery_type
21
+ return select_list(:id, what) if SelectList::INPUT_TYPES.include? mystery_type
22
+ # TODO working on this
23
+ end
24
+ end
25
+
26
+ end
27
+
28
+ describe 'Mystery input element' do
29
+
30
+ include Watirloo::Page
31
+
32
+ before do
33
+ browser.goto testfile('labels.html')
34
+ end
35
+
36
+ it 'the id is text_field' do
37
+ browser.input_id('first_nm').should be_kind_of(Watir::TextField)
38
+ end
39
+
40
+ it 'the label points to text_field' do
41
+ browser.input_label('FirstName For').should be_kind_of(Watir::TextField)
42
+ end
43
+
44
+ it "the id should return select_list" do
45
+ browser.input_id('gender_code').should be_kind_of(Watir::SelectList)
46
+ end
47
+
48
+
49
+ end
50
+
51
+