vapir-firefox 1.7.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +74 -0
- data/LICENSE.txt +42 -0
- data/README.txt +0 -0
- data/lib/vapir/ff.rb +1 -0
- data/lib/vapir/firefox.rb +1 -0
- data/lib/vapir-firefox/container.rb +462 -0
- data/lib/vapir-firefox/element.rb +277 -0
- data/lib/vapir-firefox/elements/button.rb +21 -0
- data/lib/vapir-firefox/elements/file_field.rb +27 -0
- data/lib/vapir-firefox/elements/form.rb +8 -0
- data/lib/vapir-firefox/elements/frame.rb +23 -0
- data/lib/vapir-firefox/elements/hidden.rb +12 -0
- data/lib/vapir-firefox/elements/image.rb +38 -0
- data/lib/vapir-firefox/elements/input_element.rb +12 -0
- data/lib/vapir-firefox/elements/link.rb +30 -0
- data/lib/vapir-firefox/elements/non_control_elements.rb +89 -0
- data/lib/vapir-firefox/elements/option.rb +12 -0
- data/lib/vapir-firefox/elements/radio_check_common.rb +36 -0
- data/lib/vapir-firefox/elements/select_list.rb +12 -0
- data/lib/vapir-firefox/elements/table.rb +16 -0
- data/lib/vapir-firefox/elements/table_cell.rb +12 -0
- data/lib/vapir-firefox/elements/table_row.rb +12 -0
- data/lib/vapir-firefox/elements/text_field.rb +64 -0
- data/lib/vapir-firefox/elements.rb +17 -0
- data/lib/vapir-firefox/firefox.rb +687 -0
- data/lib/vapir-firefox/jssh_socket.rb +1066 -0
- data/lib/vapir-firefox/modal_dialog.rb +144 -0
- data/lib/vapir-firefox/page_container.rb +91 -0
- data/lib/vapir-firefox/prototype.functional.js +1219 -0
- data/lib/vapir-firefox/version.rb +5 -0
- data/lib/vapir-firefox/window.rb +38 -0
- data/lib/vapir-firefox.rb +15 -0
- metadata +120 -0
data/History.txt
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
== Version 1.2.1 ==
|
2
|
+
|
3
|
+
* Fixed bug with frames in Firefox 3.
|
4
|
+
* Add Element#exist? (same as Element#exists?).
|
5
|
+
|
6
|
+
== Version 1.2.0 ==
|
7
|
+
|
8
|
+
User visible changes
|
9
|
+
|
10
|
+
* Add Button#locate from support-button.patch.
|
11
|
+
* Apply patch from Derek with support for winclicker.
|
12
|
+
* Fixed bug related to read_socket() error and changed HTML file textfields1.html so that it adheres to Firefox3 standards for firing the events.
|
13
|
+
|
14
|
+
Internal changes
|
15
|
+
|
16
|
+
* Rename test for accuracy.
|
17
|
+
* Allow unit tests to be run from Eclipse.
|
18
|
+
* Fix internal spelling error.
|
19
|
+
* Move patch files to the attic.
|
20
|
+
* Added rake file. Updated gemspec.
|
21
|
+
|
22
|
+
== Version 1.1.1 ==
|
23
|
+
|
24
|
+
* Contains couple of bug fixes and improved code related to "click()" events and page load.
|
25
|
+
|
26
|
+
== Version 1.1.0 ==
|
27
|
+
|
28
|
+
* Re-factored the code for better understanding and ease of maintainability
|
29
|
+
* Added new exception and remove exit() call if we are unable to start firefox or connect to jssh
|
30
|
+
* Changed code so that only correct type of element is returned back to the user.
|
31
|
+
* Changed code in iterators also so that it returns element of correct type.
|
32
|
+
* Added code to get text of javascript pop up.
|
33
|
+
* Fixed bugs: 11 (duplicate 16), 13 (duplicates 14, 15), 18, 19, 20, 21, 22, 23, 25, 26 (duplicate 27), 28, 29
|
34
|
+
* Added patch escaping_fix.patch for escaping quotes (") and backslash (\).
|
35
|
+
* Changed code to open and close Firefox more gracefully.
|
36
|
+
* Added code to show all objects in document or inside any element.
|
37
|
+
* Add methods like show_forms, show_images, show_frames, show_links etc
|
38
|
+
* Improved handling for Javascript pop ups. Currently only alert and confirm javascript pop up can be handled.
|
39
|
+
* Added support to get correct type of element like (Checkbox, Radiobutton) using XPath.
|
40
|
+
* Added code to start Firefox on Linux automatically
|
41
|
+
* Added new XPI for windows for showing up JSSh extension in Add-On’s/Extensions list
|
42
|
+
|
43
|
+
== Version 1.0.2 ==
|
44
|
+
|
45
|
+
This version addresses issues discovered in the prior release and is more compatible to Watir scripts, thanks to all the users for sharing their experiences with !FireWatir.
|
46
|
+
|
47
|
+
* Implemented to_s for all the elements which returns element specific attributes along with attributes that apply to all the elements.
|
48
|
+
* Implemented iterators for all the elements.
|
49
|
+
* Implemented show_all_objects.
|
50
|
+
* Added support to access 'button' elements. Thanks to patch send by Todd Fisher.
|
51
|
+
* Fixed bugs
|
52
|
+
* !FireWatir::Firefox.html doesn't exists, by cdc@cyphers.dns2go.com
|
53
|
+
* Cannot access button using value when the html is "<button type="submit">Sign In</button>" by Vikash Kumar.
|
54
|
+
* Firewatir fails finding link by text when html is "<a href="http://www.test.com"><span class="a">Go Test</span></a>" by Kevin Alsteens.
|
55
|
+
* elements_by_xpath bug by Dan Zwell.
|
56
|
+
* !JavaScript redirection bug by Phil
|
57
|
+
* Made it more compatible with scripts written for watir.
|
58
|
+
* Code documentation.
|
59
|
+
|
60
|
+
== Version 1.0.1 ==
|
61
|
+
|
62
|
+
Along with the main endeavor of !FireWatir i.e the scripts written for IE on windows platform can be used with minimal changes on Firefox browser, !FireWatir comes with following additional features
|
63
|
+
|
64
|
+
* Platform independent, as there is nothing being used that is platform dependent. This enable !FireWatir to work on any platform with Firefox browser and the JSSh extension installed. It's been tested on Windows Server 2003 Enterprise Edition, Windows XP Professional SP2. It has not yet been tested on Linux and Mac, but it should work. The gems will be released after the testing.
|
65
|
+
* Script can be run on any remote machine, which means any machine connected to your network.
|
66
|
+
* !FireWatir is tested with ruby version 1.8.2 and 1.8.4.
|
67
|
+
* Tested on Firefox version 1.5, 1.5.0.4, 1.5.0.7 , 2.0 and 2.0.0.1.
|
68
|
+
* For handling !JavaScript popups no third party tool or dll is used, and the window need not to be a active window. Popups are handled in such a way that the action of clicking the popup buttons remains the same. But, the user experience differs in way that the popups are not visible to the users.
|
69
|
+
* Firefox has built in support for XPath, so it's faster to get an element by XPath on Firefox.
|
70
|
+
* Firefox browser is more compliant with w3c standards. [http://www.xulplanet.com/references/elemref/ Click here] for information on elements their methods and properties.
|
71
|
+
* It’s visibly faster when compared to Watir.
|
72
|
+
* Firefox will be started automatically for Windows when test script is exceuted. Currently it works only on Windows.
|
73
|
+
* Has support for Frames and IFrames.
|
74
|
+
* Added documentation, check gems/docs.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
The Vapir-Firefox library comes from a number of sources and authors, all released
|
2
|
+
under the Modified BSD License:
|
3
|
+
- Original contributions by Ethan:
|
4
|
+
Copyright: Ethan 2009-2010
|
5
|
+
License: Modified BSD license (full text below)
|
6
|
+
|
7
|
+
- The Firewatir library from which Vapir-Firefox was forked:
|
8
|
+
Copyright:
|
9
|
+
Copyright (c) 2004 - 2005, Paul Rogers and Bret Pettichord
|
10
|
+
Copyright (c) 2006 - 2007, Angrez Singh
|
11
|
+
Copyright (c) 2008, Bret Pettichord
|
12
|
+
License: Modified BSD license (full text below)
|
13
|
+
|
14
|
+
|
15
|
+
Full text of the Modified BSD License:
|
16
|
+
All rights reserved.
|
17
|
+
|
18
|
+
Redistribution and use in source and binary forms, with or without
|
19
|
+
modification, are permitted provided that the following conditions are met:
|
20
|
+
|
21
|
+
1. Redistributions of source code must retain the above copyright notice,
|
22
|
+
this list of conditions and the following disclaimer.
|
23
|
+
|
24
|
+
2. Redistributions in binary form must reproduce the above copyright
|
25
|
+
notice, this list of conditions and the following disclaimer in the
|
26
|
+
documentation and/or other materials provided with the distribution.
|
27
|
+
|
28
|
+
3. Neither the names Paul Rogers, Bret Pettichord nor the names of contributors to
|
29
|
+
this software may be used to endorse or promote products derived from this
|
30
|
+
software without specific prior written permission.
|
31
|
+
|
32
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
33
|
+
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
34
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
35
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
36
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
37
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
38
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
39
|
+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
40
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
41
|
+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
42
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.txt
ADDED
File without changes
|
data/lib/vapir/ff.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'vapir-firefox'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'vapir-firefox'
|
@@ -0,0 +1,462 @@
|
|
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 'vapir-common/container'
|
41
|
+
|
42
|
+
module Vapir
|
43
|
+
module Firefox::Container
|
44
|
+
include Vapir::Container
|
45
|
+
|
46
|
+
def extra_for_contained
|
47
|
+
default_extra_for_contained.merge(:jssh_socket => jssh_socket)
|
48
|
+
end
|
49
|
+
|
50
|
+
public
|
51
|
+
# Returns array of element objects that match the given XPath query.
|
52
|
+
# Refer: https://developer.mozilla.org/en/DOM/document.evaluate
|
53
|
+
def element_objects_by_xpath(xpath)
|
54
|
+
elements=[]
|
55
|
+
result=document_object.evaluate(xpath, containing_object, nil, jssh_socket.Components.interfaces.nsIDOMXPathResult.ORDERED_NODE_ITERATOR_TYPE, nil)
|
56
|
+
while element=result.iterateNext
|
57
|
+
elements << element.store_rand_object_key(@browser_jssh_objects)
|
58
|
+
end
|
59
|
+
elements
|
60
|
+
end
|
61
|
+
|
62
|
+
# Returns the first element object that matches the given XPath query.
|
63
|
+
# Refer: http://developer.mozilla.org/en/docs/DOM:document.evaluate
|
64
|
+
def element_object_by_xpath(xpath)
|
65
|
+
document_object.evaluate(xpath, containing_object, nil, jssh_socket.Components.interfaces.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE, nil).singleNodeValue
|
66
|
+
end
|
67
|
+
|
68
|
+
# Returns the first element that matches the given xpath expression or query.
|
69
|
+
def element_by_xpath(xpath)
|
70
|
+
# TODO: move this to common; should work the same for IE
|
71
|
+
base_element_class.factory(element_object_by_xpath(xpath), extra_for_contained)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Returns the array of elements that match the given xpath query.
|
75
|
+
def elements_by_xpath(xpath)
|
76
|
+
# TODO/FIX: shouldn't this return an ElementCollection? tests seem to expect it not to, addressing it with 0-based indexing, but that seems insconsistent with everything else.
|
77
|
+
# TODO: move this to common; should work the same for IE
|
78
|
+
element_objects_by_xpath(xpath).map do |element_object|
|
79
|
+
base_element_class.factory(element_object, extra_for_contained)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
=begin
|
84
|
+
#
|
85
|
+
# Description:
|
86
|
+
# Used to access a frame element. Usually an <frame> or <iframe> HTML tag.
|
87
|
+
#
|
88
|
+
# Input:
|
89
|
+
# - how - The attribute used to identify the framet.
|
90
|
+
# - what - The value of that attribute.
|
91
|
+
# If only one parameter is supplied, "how" is by default taken as name and the
|
92
|
+
# parameter supplied becomes the value of the name attribute.
|
93
|
+
#
|
94
|
+
# Typical usage:
|
95
|
+
#
|
96
|
+
# ff.frame(:index, 1)
|
97
|
+
# ff.frame(:name , 'main_frame')
|
98
|
+
# ff.frame('main_frame') # in this case, just a name is supplied.
|
99
|
+
#
|
100
|
+
# Output:
|
101
|
+
# Frame object or nil if the specified frame does not exist.
|
102
|
+
#
|
103
|
+
def frame(how, what = nil)
|
104
|
+
element_by_howwhat(Firefox::Frame, how, what)
|
105
|
+
end
|
106
|
+
|
107
|
+
#
|
108
|
+
# Description:
|
109
|
+
# Used to access a form element. Usually an <form> HTML tag.
|
110
|
+
#
|
111
|
+
# Input:
|
112
|
+
# - how - The attribute used to identify the form.
|
113
|
+
# - what - The value of that attribute.
|
114
|
+
# If only one parameter is supplied, "how" is by default taken as name and the
|
115
|
+
# parameter supplied becomes the value of the name attribute.
|
116
|
+
#
|
117
|
+
# Typical usage:
|
118
|
+
#
|
119
|
+
# ff.form(:index, 1)
|
120
|
+
# ff.form(:name , 'main_form')
|
121
|
+
# ff.form('main_form') # in this case, just a name is supplied.
|
122
|
+
#
|
123
|
+
# Output:
|
124
|
+
# Form object.
|
125
|
+
#
|
126
|
+
def form(how, what=nil)
|
127
|
+
element_by_howwhat(Firefox::Form, how, what)
|
128
|
+
end
|
129
|
+
|
130
|
+
#
|
131
|
+
# Description:
|
132
|
+
# Used to access a table. Usually an <table> HTML tag.
|
133
|
+
#
|
134
|
+
# Input:
|
135
|
+
# - how - The attribute used to identify the table.
|
136
|
+
# - what - The value of that attribute.
|
137
|
+
#
|
138
|
+
# Typical usage:
|
139
|
+
#
|
140
|
+
# ff.table(:index, 1) #index starts from 1.
|
141
|
+
# ff.table(:id, 'main_table')
|
142
|
+
#
|
143
|
+
# Output:
|
144
|
+
# Table object.
|
145
|
+
#
|
146
|
+
def table(how, what=nil)
|
147
|
+
element_by_howwhat(Firefox::Table, how, what)
|
148
|
+
end
|
149
|
+
|
150
|
+
#
|
151
|
+
# Description:
|
152
|
+
# Used to access a table cell. Usually an <td> HTML tag.
|
153
|
+
#
|
154
|
+
# Input:
|
155
|
+
# - how - The attribute used to identify the cell.
|
156
|
+
# - what - The value of that attribute.
|
157
|
+
#
|
158
|
+
# Typical Usage:
|
159
|
+
# ff.table_cell(:id, 'tb_cell')
|
160
|
+
# ff.table_cell(:index, 1)
|
161
|
+
#
|
162
|
+
# Output:
|
163
|
+
# TableCell Object
|
164
|
+
#
|
165
|
+
def table_cell(how, what=nil)
|
166
|
+
element_by_howwhat(Firefox::TableCell, how, what)
|
167
|
+
end
|
168
|
+
|
169
|
+
#
|
170
|
+
# Description:
|
171
|
+
# Used to access a table row. Usually an <tr> HTML tag.
|
172
|
+
#
|
173
|
+
# Input:
|
174
|
+
# - how - The attribute used to identify the row.
|
175
|
+
# - what - The value of that attribute.
|
176
|
+
#
|
177
|
+
# Typical Usage:
|
178
|
+
# ff.row(:id, 'tb_row')
|
179
|
+
# ff.row(:index, 1)
|
180
|
+
#
|
181
|
+
# Output:
|
182
|
+
# TableRow object
|
183
|
+
#
|
184
|
+
def table_row(how, what=nil)
|
185
|
+
element_by_howwhat(Firefox::TableRow, how, what)
|
186
|
+
end
|
187
|
+
|
188
|
+
#
|
189
|
+
# Description:
|
190
|
+
# Used to access a button element. Usually an <input type = "button"> HTML tag.
|
191
|
+
#
|
192
|
+
# Input:
|
193
|
+
# - how - The attribute used to identify the row.
|
194
|
+
# - what - The value of that attribute.
|
195
|
+
#
|
196
|
+
# Typical Usage:
|
197
|
+
# ff.button(:id, 'b_1') # access the button with an ID of b_1
|
198
|
+
# ff.button(:name, 'verify_data') # access the button with a name of verify_data
|
199
|
+
#
|
200
|
+
# if only a single parameter is supplied, then :value is used as 'how' and parameter supplied is used as what.
|
201
|
+
#
|
202
|
+
# ff.button('Click Me') # access the button with a value of Click Me
|
203
|
+
#
|
204
|
+
# Output:
|
205
|
+
# Button element.
|
206
|
+
#
|
207
|
+
def button(how, what=nil)
|
208
|
+
element_by_howwhat(Firefox::Button, how, what)
|
209
|
+
end
|
210
|
+
|
211
|
+
#
|
212
|
+
# Description:
|
213
|
+
# Used for accessing a file field. Usually an <input type = file> HTML tag.
|
214
|
+
#
|
215
|
+
# Input:
|
216
|
+
# - how - Attribute used to identify the file field element
|
217
|
+
# - what - Value of that attribute.
|
218
|
+
#
|
219
|
+
# Typical Usage:
|
220
|
+
# ff.file_field(:id, 'up_1') # access the file upload fff.d with an ID of up_1
|
221
|
+
# ff.file_field(:name, 'upload') # access the file upload fff.d with a name of upload
|
222
|
+
#
|
223
|
+
# Output:
|
224
|
+
# FileField object
|
225
|
+
#
|
226
|
+
def file_field(how, what = nil)
|
227
|
+
element_by_howwhat(Firefox::FileField, how, what)
|
228
|
+
end
|
229
|
+
|
230
|
+
#
|
231
|
+
# Description:
|
232
|
+
# Used for accessing a text field. Usually an <input type = text> HTML tag. or a text area - a <textarea> tag
|
233
|
+
#
|
234
|
+
# Input:
|
235
|
+
# - how - Attribute used to identify the text field element.
|
236
|
+
# - what - Value of that attribute.
|
237
|
+
#
|
238
|
+
# Typical Usage:
|
239
|
+
#
|
240
|
+
# ff.text_field(:id, 'user_name') # access the text field with an ID of user_name
|
241
|
+
# ff.text_field(:name, 'address') # access the text field with a name of address
|
242
|
+
#
|
243
|
+
# Output:
|
244
|
+
# TextField object.
|
245
|
+
#
|
246
|
+
def text_field(how, what = nil)
|
247
|
+
element_by_howwhat(Firefox::TextField, how, what)
|
248
|
+
end
|
249
|
+
|
250
|
+
#
|
251
|
+
# Description:
|
252
|
+
# Used to access hidden field element. Usually an <input type = hidden> HTML tag
|
253
|
+
#
|
254
|
+
# Input:
|
255
|
+
# - how - Attribute used to identify the hidden element.
|
256
|
+
# - what - Value of that attribute.
|
257
|
+
#
|
258
|
+
# Typical Usage:
|
259
|
+
#
|
260
|
+
# ff.hidden(:id, 'user_name') # access the hidden element with an ID of user_name
|
261
|
+
# ff.hidden(:name, 'address') # access the hidden element with a name of address
|
262
|
+
#
|
263
|
+
# Output:
|
264
|
+
# Hidden object.
|
265
|
+
#
|
266
|
+
def hidden(how, what=nil)
|
267
|
+
element_by_howwhat(Firefox::Hidden, how, what)
|
268
|
+
end
|
269
|
+
|
270
|
+
#
|
271
|
+
# Description:
|
272
|
+
# Used to access select list element. Usually an <select> HTML tag.
|
273
|
+
#
|
274
|
+
# Input:
|
275
|
+
# - how - Attribute used to identify the select element.
|
276
|
+
# - what - Value of that attribute.
|
277
|
+
#
|
278
|
+
# Typical Usage:
|
279
|
+
#
|
280
|
+
# ff.select_list(:id, 'user_name') # access the select list with an ID of user_name
|
281
|
+
# ff.select_list(:name, 'address') # access the select list with a name of address
|
282
|
+
#
|
283
|
+
# Output:
|
284
|
+
# Select List object.
|
285
|
+
#
|
286
|
+
def select_list(how, what=nil)
|
287
|
+
element_by_howwhat(Firefox::SelectList, how, what)
|
288
|
+
end
|
289
|
+
def option(how, what=nil)
|
290
|
+
element_by_howwhat(Firefox::Option, how, what)
|
291
|
+
end
|
292
|
+
=end
|
293
|
+
#
|
294
|
+
# Description:
|
295
|
+
# Used to access checkbox element. Usually an <input type = checkbox> HTML tag.
|
296
|
+
#
|
297
|
+
# Input:
|
298
|
+
# - how - Attribute used to identify the check box element.
|
299
|
+
# - what - Value of that attribute.
|
300
|
+
#
|
301
|
+
# Typical Usage:
|
302
|
+
#
|
303
|
+
# ff.checkbox(:id, 'user_name') # access the checkbox element with an ID of user_name
|
304
|
+
# ff.checkbox(:name, 'address') # access the checkbox element with a name of address
|
305
|
+
# In many instances, checkboxes on an html page have the same name, but are identified by different values. An example is shown next.
|
306
|
+
#
|
307
|
+
# <input type = checkbox name = email_frequency value = 'daily' > Daily Email
|
308
|
+
# <input type = checkbox name = email_frequency value = 'Weekly'> Weekly Email
|
309
|
+
# <input type = checkbox name = email_frequency value = 'monthly'>Monthly Email
|
310
|
+
#
|
311
|
+
# Vapir can access these using the following:
|
312
|
+
#
|
313
|
+
# ff.checkbox(:id, 'day_to_send' , 'monday' ) # access the check box with an id of day_to_send and a value of monday
|
314
|
+
# ff.checkbox(:name ,'email_frequency', 'weekly') # access the check box with a name of email_frequency and a value of 'weekly'
|
315
|
+
#
|
316
|
+
# Output:
|
317
|
+
# Checkbox object.
|
318
|
+
#
|
319
|
+
# def checkbox(how, what=nil, value=nil)
|
320
|
+
# element_by_howwhat(Firefox::CheckBox, how, what, {:other_attributes => value ? {:value => value} : nil})
|
321
|
+
# end
|
322
|
+
|
323
|
+
#
|
324
|
+
# Description:
|
325
|
+
# Used to access radio button element. Usually an <input type = radio> HTML tag.
|
326
|
+
#
|
327
|
+
# Input:
|
328
|
+
# - how - Attribute used to identify the radio button element.
|
329
|
+
# - what - Value of that attribute.
|
330
|
+
#
|
331
|
+
# Typical Usage:
|
332
|
+
#
|
333
|
+
# ff.radio(:id, 'user_name') # access the radio button element with an ID of user_name
|
334
|
+
# ff.radio(:name, 'address') # access the radio button element with a name of address
|
335
|
+
# In many instances, radio buttons on an html page have the same name, but are identified by different values. An example is shown next.
|
336
|
+
#
|
337
|
+
# <input type = radio name = email_frequency value = 'daily' > Daily Email
|
338
|
+
# <input type = radio name = email_frequency value = 'Weekly'> Weekly Email
|
339
|
+
# <input type = radio name = email_frequency value = 'monthly'>Monthly Email
|
340
|
+
#
|
341
|
+
# Vapir can access these using the following:
|
342
|
+
#
|
343
|
+
# ff.radio(:id, 'day_to_send' , 'monday' ) # access the radio button with an id of day_to_send and a value of monday
|
344
|
+
# ff.radio(:name ,'email_frequency', 'weekly') # access the radio button with a name of email_frequency and a value of 'weekly'
|
345
|
+
#
|
346
|
+
# Output:
|
347
|
+
# Radio button object.
|
348
|
+
#
|
349
|
+
# def radio(how, what=nil, value=nil)
|
350
|
+
# element_by_howwhat(Firefox::Radio, how, what, {:other_attributes => value ? {:value => value} : nil})
|
351
|
+
# end
|
352
|
+
|
353
|
+
#
|
354
|
+
# Description:
|
355
|
+
# Used to access link element. Usually an <a> HTML tag.
|
356
|
+
#
|
357
|
+
# Input:
|
358
|
+
# - how - Attribute used to identify the link element.
|
359
|
+
# - what - Value of that attribute.
|
360
|
+
#
|
361
|
+
# Typical Usage:
|
362
|
+
#
|
363
|
+
# ff.link(:id, 'user_name') # access the link element with an ID of user_name
|
364
|
+
# ff.link(:name, 'address') # access the link element with a name of address
|
365
|
+
#
|
366
|
+
# Output:
|
367
|
+
# Link object.
|
368
|
+
#
|
369
|
+
# def link(how, what=nil)
|
370
|
+
# element_by_howwhat(Firefox::Link, how, what)
|
371
|
+
# end
|
372
|
+
|
373
|
+
#
|
374
|
+
# Description:
|
375
|
+
# Used to access image element. Usually an <img> HTML tag.
|
376
|
+
#
|
377
|
+
# Input:
|
378
|
+
# - how - Attribute used to identify the image element.
|
379
|
+
# - what - Value of that attribute.
|
380
|
+
#
|
381
|
+
# Typical Usage:
|
382
|
+
#
|
383
|
+
# ff.image(:id, 'user_name') # access the image element with an ID of user_name
|
384
|
+
# ff.image(:name, 'address') # access the image element with a name of address
|
385
|
+
#
|
386
|
+
# Output:
|
387
|
+
# Image object.
|
388
|
+
#
|
389
|
+
# def image(how, what = nil)
|
390
|
+
# element_by_howwhat(Firefox::Image, how, what)
|
391
|
+
# end
|
392
|
+
|
393
|
+
|
394
|
+
#
|
395
|
+
# Description:
|
396
|
+
# Used to access a definition list element - a <dl> HTML tag.
|
397
|
+
#
|
398
|
+
# Input:
|
399
|
+
# - how - Attribute used to identify the definition list element.
|
400
|
+
# - what - Value of that attribute.
|
401
|
+
#
|
402
|
+
# Typical Usage:
|
403
|
+
#
|
404
|
+
# ff.dl(:id, 'user_name') # access the dl element with an ID of user_name
|
405
|
+
# ff.dl(:title, 'address') # access the dl element with a title of address
|
406
|
+
#
|
407
|
+
# Returns:
|
408
|
+
# Dl object.
|
409
|
+
#
|
410
|
+
# def dl(how, what = nil)
|
411
|
+
# element_by_howwhat(Firefox::Dl, how, what)
|
412
|
+
# end
|
413
|
+
|
414
|
+
#
|
415
|
+
# Description:
|
416
|
+
# Used to access a definition term element - a <dt> HTML tag.
|
417
|
+
#
|
418
|
+
# Input:
|
419
|
+
# - how - Attribute used to identify the image element.
|
420
|
+
# - what - Value of that attribute.
|
421
|
+
#
|
422
|
+
# Typical Usage:
|
423
|
+
#
|
424
|
+
# ff.dt(:id, 'user_name') # access the dt element with an ID of user_name
|
425
|
+
# ff.dt(:title, 'address') # access the dt element with a title of address
|
426
|
+
#
|
427
|
+
# Returns:
|
428
|
+
# Dt object.
|
429
|
+
#
|
430
|
+
# def dt(how, what = nil)
|
431
|
+
# element_by_howwhat(Firefox::Dt, how, what)
|
432
|
+
# end
|
433
|
+
|
434
|
+
#
|
435
|
+
# Description:
|
436
|
+
# Used to access a definition description element - a <dd> HTML tag.
|
437
|
+
#
|
438
|
+
# Input:
|
439
|
+
# - how - Attribute used to identify the image element.
|
440
|
+
# - what - Value of that attribute.
|
441
|
+
#
|
442
|
+
# Typical Usage:
|
443
|
+
#
|
444
|
+
# ff.dd(:id, 'user_name') # access the dd element with an ID of user_name
|
445
|
+
# ff.dd(:title, 'address') # access the dd element with a title of address
|
446
|
+
#
|
447
|
+
# Returns:
|
448
|
+
# Dd object.
|
449
|
+
#
|
450
|
+
# def dd(how, what = nil)
|
451
|
+
# element_by_howwhat(Firefox::Dd, how, what)
|
452
|
+
# end
|
453
|
+
|
454
|
+
# Description:
|
455
|
+
# Searching for Page Elements. Not for external consumption.
|
456
|
+
#
|
457
|
+
# def ole_inner_elements
|
458
|
+
# return document.body.all
|
459
|
+
# end
|
460
|
+
# private :ole_inner_elements
|
461
|
+
end
|
462
|
+
end # module
|