firewatir 1.6.5 → 1.6.6.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/CHANGES +461 -0
  2. data/LICENSE +31 -31
  3. data/README.rdoc +112 -0
  4. data/VERSION +1 -0
  5. data/lib/firewatir.rb +41 -40
  6. data/lib/firewatir/container.rb +491 -491
  7. data/lib/firewatir/document.rb +239 -239
  8. data/lib/firewatir/element.rb +1364 -1364
  9. data/lib/firewatir/element_collections.rb +314 -314
  10. data/lib/firewatir/elements/button.rb +15 -15
  11. data/lib/firewatir/elements/file_field.rb +29 -29
  12. data/lib/firewatir/elements/form.rb +40 -40
  13. data/lib/firewatir/elements/frame.rb +55 -55
  14. data/lib/firewatir/elements/hidden.rb +56 -56
  15. data/lib/firewatir/elements/image.rb +139 -139
  16. data/lib/firewatir/elements/input_element.rb +44 -44
  17. data/lib/firewatir/elements/link.rb +76 -76
  18. data/lib/firewatir/elements/non_control_element.rb +53 -53
  19. data/lib/firewatir/elements/non_control_elements.rb +108 -108
  20. data/lib/firewatir/elements/not_used.rb +278 -278
  21. data/lib/firewatir/elements/option.rb +130 -130
  22. data/lib/firewatir/elements/radio_check_common.rb +163 -163
  23. data/lib/firewatir/elements/select_list.rb +188 -188
  24. data/lib/firewatir/elements/table.rb +218 -218
  25. data/lib/firewatir/elements/table_cell.rb +54 -54
  26. data/lib/firewatir/elements/table_row.rb +100 -100
  27. data/lib/firewatir/elements/text_field.rb +218 -218
  28. data/lib/firewatir/exceptions.rb +10 -10
  29. data/lib/firewatir/firefox.rb +984 -1040
  30. data/lib/firewatir/jssh_socket.rb +100 -100
  31. data/lib/firewatir/winClicker.rb +122 -122
  32. data/lib/firewatir/x11.rb +192 -192
  33. data/rakefile.rb +15 -0
  34. data/unittests/attach_to_new_window_test.rb +49 -49
  35. data/unittests/bug_fixes_test.rb +195 -195
  36. data/unittests/buttons_xpath_test.rb +88 -88
  37. data/unittests/checkbox_test.rb +158 -158
  38. data/unittests/checkbox_xpath_test.rb +107 -107
  39. data/unittests/div_test.rb +275 -275
  40. data/unittests/ff_test.rb +47 -0
  41. data/unittests/filefield_test.rb +49 -49
  42. data/unittests/filefield_xpath_test.rb +35 -35
  43. data/unittests/form_test.rb +296 -296
  44. data/unittests/frame_test.rb +159 -159
  45. data/unittests/hidden_test.rb +85 -85
  46. data/unittests/hidden_xpath_test.rb +72 -72
  47. data/unittests/html/JavascriptClick.html +42 -42
  48. data/unittests/html/blankpage.html +11 -11
  49. data/unittests/html/buttons1.html +61 -61
  50. data/unittests/html/checkboxes1.html +70 -70
  51. data/unittests/html/complex_table.html +36 -36
  52. data/unittests/html/cssTest.html +42 -42
  53. data/unittests/html/div.html +72 -72
  54. data/unittests/html/div_xml.html +20 -20
  55. data/unittests/html/fileupload.html +45 -45
  56. data/unittests/html/formTest1.html +38 -38
  57. data/unittests/html/forms2.html +45 -45
  58. data/unittests/html/forms3.html +132 -132
  59. data/unittests/html/forms4.html +27 -27
  60. data/unittests/html/frame_buttons.html +3 -3
  61. data/unittests/html/frame_links.html +3 -3
  62. data/unittests/html/frame_multi.html +4 -4
  63. data/unittests/html/iframeTest.html +14 -14
  64. data/unittests/html/iframeTest1.html +13 -13
  65. data/unittests/html/iframeTest2.html +5 -5
  66. data/unittests/html/images1.html +66 -66
  67. data/unittests/html/javascriptevents.html +35 -35
  68. data/unittests/html/link_pass.html +10 -10
  69. data/unittests/html/links1.html +42 -42
  70. data/unittests/html/links2.html +10 -10
  71. data/unittests/html/modal_dialog.html +8 -8
  72. data/unittests/html/modal_dialog_launcher.html +11 -11
  73. data/unittests/html/nestedFrames.html +6 -6
  74. data/unittests/html/new_browser.html +17 -17
  75. data/unittests/html/new_browser_popup.html +7 -7
  76. data/unittests/html/pass.html +9 -9
  77. data/unittests/html/popups1.html +60 -60
  78. data/unittests/html/pre.html +27 -27
  79. data/unittests/html/radioButtons1.html +70 -70
  80. data/unittests/html/redirect.html +10 -10
  81. data/unittests/html/redirect1.html +8 -8
  82. data/unittests/html/redirect2.html +8 -8
  83. data/unittests/html/redirect3.html +8 -8
  84. data/unittests/html/select_tealeaf.html +54 -54
  85. data/unittests/html/selectboxes1.html +55 -55
  86. data/unittests/html/simple_table.html +26 -26
  87. data/unittests/html/simple_table_buttons.html +104 -104
  88. data/unittests/html/simple_table_columns.html +74 -74
  89. data/unittests/html/table1.html +165 -165
  90. data/unittests/html/tableCell_using_xpath.html +19 -19
  91. data/unittests/html/textarea.html +30 -30
  92. data/unittests/html/textfields1.html +62 -62
  93. data/unittests/html/textsearch.html +44 -44
  94. data/unittests/images_test.rb +198 -198
  95. data/unittests/images_xpath_test.rb +118 -118
  96. data/unittests/javascript_test.rb +75 -75
  97. data/unittests/links_test.rb +231 -231
  98. data/unittests/links_xpath_test.rb +79 -79
  99. data/unittests/mozilla_all_tests.rb +7 -7
  100. data/unittests/pre_test.rb +75 -75
  101. data/unittests/radios_test.rb +166 -166
  102. data/unittests/radios_xpath_test.rb +101 -101
  103. data/unittests/redirect_test.rb +41 -41
  104. data/unittests/selectbox_test.rb +142 -142
  105. data/unittests/selectbox_xpath_test.rb +129 -129
  106. data/unittests/setup.rb +29 -29
  107. data/unittests/table_test.rb +385 -385
  108. data/unittests/table_xpath_test.rb +185 -185
  109. data/unittests/textfields_test.rb +234 -234
  110. data/unittests/textfields_xpath_test.rb +113 -113
  111. metadata +51 -19
  112. data/lib/firewatir/version.rb +0 -5
data/LICENSE CHANGED
@@ -1,32 +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
- --------------------------------------------------------------------------
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
32
  (based on BSD Open Source License)
data/README.rdoc ADDED
@@ -0,0 +1,112 @@
1
+ = FireWatir
2
+ This is FireWatir, Web Application Testing In Ruby using Firefox browser
3
+
4
+ Project Home:: http://www.watir.com
5
+ Gem:: http://gemcutter.org/gems/firewatir
6
+ Source Code:: http://github.com/bret/watir
7
+ General Usage Discussions:: http://groups.google.com/group/watir-general
8
+ Development Discussions:: http://rubyforge.org/mailman/listinfo/wtr-development
9
+ Bugs, Issues, Roadmap:: http://jira.openqa.org/browse/WTR
10
+
11
+ == DESCRIPTION
12
+
13
+ Firewatir is part of Watir project, a family of open-source drivers for automating web browsers.
14
+ For other browsers please see www.watir.com
15
+
16
+ == EXAMPLES
17
+ * http://watir.com/examples
18
+
19
+ Start new Firefox browser driver
20
+
21
+ # using Watir::Browser interface
22
+ require 'watir'
23
+ Watir::Browser.default = 'firefox'
24
+ browser = Watir::Browser.new
25
+
26
+ # or using Firewatir library directly
27
+ require 'firewatir'
28
+ browser = FireWatir::Firefox.new
29
+
30
+ Typical usage
31
+
32
+ require "firewatir"
33
+ # go to the page you want to test
34
+ ff = FireWatir::Firefox.start("http://myserver/mypage")
35
+
36
+ # enter "Angrez" into an input field named "username"
37
+ ff.text_field(:name, "username").set("Angrez")
38
+
39
+ # enter "Ruby Co" into input field with id "company_ID"
40
+ ff.text_field(:id, "company_ID").set("Ruby Co")
41
+
42
+ # click on a link that has "green" somewhere in the text that is displayed
43
+ # to the user, using a regular expression
44
+ ff.link(:text, /green/)
45
+
46
+ # click button that has a caption of "Cancel"
47
+ ff.button(:value, "Cancel").click
48
+
49
+ == FEATURES
50
+
51
+ FireWatir allows your script to read and interact with HTML objects--HTML tags and their attributes and contents.
52
+ Types of objects that FireWatir can identify include:
53
+
54
+ Type Description
55
+ =========== ===============================================================
56
+ button <tt><input></tt> tags, with the type="button" attribute
57
+ check_box <tt><input></tt> tags, with the type="checkbox" attribute
58
+ div <tt><div></tt> tags
59
+ form
60
+ frame
61
+ hidden hidden <tt><input></tt> tags
62
+ image <tt><img></tt> tags
63
+ label
64
+ link <tt><a></tt> (anchor) tags
65
+ p <tt><p></tt> (paragraph) tags
66
+ radio radio buttons; <tt><input></tt> tags, with the type="radio" attribute
67
+ select_list <tt><select></tt> tags, known informally as drop-down boxes
68
+ span <tt><span></tt> tags
69
+ table <tt><table></tt> tags
70
+ text_field <tt><input></tt> tags with the type="text" attribute (a single-line
71
+ text field), the type="text_area" attribute (a multi-line
72
+ text field), and the type="password" attribute (a
73
+ single-line field in which the input is replaced with asterisks)
74
+
75
+ In general, there are several ways to identify a specific object. FireWatir's
76
+ syntax is in the form (how, what), where "how" is a means of identifying
77
+ the object, and "what" is the specific string or regular expression
78
+ that FireWatir will seek, as shown in the examples above. Available "how"
79
+ options depend upon the type of object, but here are a few examples:
80
+
81
+ How Description
82
+ ============ ===============================================================
83
+ :id Used to find an object that has an "id=" attribute. Since each
84
+ id should be unique, according to the XHTML specification,
85
+ this is recommended as the most reliable method to find an
86
+ object.
87
+ :name Used to find an object that has a "name=" attribute. This is
88
+ useful for older versions of HTML, but "name" is deprecated
89
+ in XHTML.
90
+ :value Used to find a text field with a given default value, or a
91
+ button with a given caption
92
+ :index Used to find the nth object of the specified type on a page.
93
+ For example, button(:index, 2) finds the second button.
94
+ Current versions of FireWatir use 1-based indexing, but future
95
+ versions will use 0-based indexing.
96
+ :xpath The xpath expression for identifying the element.
97
+
98
+ Note that the XHTML specification requires that tags and their attributes be
99
+ in lower case. FireWatir doesn't enforce this; FireWatir will find tags and
100
+ attributes whether they're in upper, lower, or mixed case. This is either
101
+ a bug or a feature.
102
+
103
+
104
+ == INSTALL
105
+ * http://wiki.openqa.org/display/WTR/FireWatir+Installation
106
+
107
+ Firewatir gen is normally installed during watir gem installation
108
+ however you need to install Jssh to communicate with Firefox.
109
+
110
+ [sudo] gem install firewatir
111
+
112
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.6.6.rc1
data/lib/firewatir.rb CHANGED
@@ -1,40 +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
- Watir::Browser.default = 'firefox'
1
+ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
+
3
+ require 'socket'
4
+ gem 'activesupport', '=2.3.9'
5
+ require 'active_support'
6
+
7
+ require 'firewatir/exceptions'
8
+ require 'firewatir/jssh_socket'
9
+ require 'firewatir/container'
10
+ require "firewatir/element"
11
+ require "firewatir/document"
12
+
13
+ require "firewatir/elements/form"
14
+ require "firewatir/elements/frame"
15
+ require "firewatir/elements/non_control_element"
16
+ require "firewatir/elements/non_control_elements"
17
+ require "firewatir/elements/table"
18
+ require "firewatir/elements/table_row"
19
+ require "firewatir/elements/table_cell"
20
+ require "firewatir/elements/image"
21
+ require "firewatir/elements/link"
22
+ require "firewatir/elements/input_element"
23
+ require "firewatir/elements/select_list"
24
+ require "firewatir/elements/option"
25
+ require "firewatir/elements/button"
26
+ require "firewatir/elements/text_field"
27
+ require "firewatir/elements/hidden"
28
+ require "firewatir/elements/file_field"
29
+ require "firewatir/elements/radio_check_common"
30
+ require "firewatir/element_collections"
31
+
32
+ require 'watir/matches'
33
+ require 'firewatir/firefox'
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'
@@ -1,491 +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
-
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
+