celerity 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +33 -0
- data/README.txt +19 -9
- data/Rakefile +9 -3
- data/lib/celerity.rb +39 -39
- data/lib/celerity/browser.rb +538 -153
- data/lib/celerity/clickable_element.rb +48 -7
- data/lib/celerity/collections.rb +155 -131
- data/lib/celerity/container.rb +766 -385
- data/lib/celerity/default_viewer.rb +10 -0
- data/lib/celerity/disabled_element.rb +19 -2
- data/lib/celerity/element.rb +152 -83
- data/lib/celerity/element_collection.rb +106 -0
- data/lib/celerity/element_locator.rb +89 -66
- data/lib/celerity/elements/button.rb +23 -13
- data/lib/celerity/elements/file_field.rb +17 -5
- data/lib/celerity/elements/form.rb +21 -16
- data/lib/celerity/elements/frame.rb +75 -53
- data/lib/celerity/elements/image.rb +76 -63
- data/lib/celerity/elements/label.rb +4 -2
- data/lib/celerity/elements/link.rb +30 -18
- data/lib/celerity/elements/meta.rb +6 -0
- data/lib/celerity/{non_control_elements.rb → elements/non_control_elements.rb} +106 -76
- data/lib/celerity/elements/option.rb +16 -2
- data/lib/celerity/elements/radio_check.rb +55 -20
- data/lib/celerity/elements/select_list.rb +65 -29
- data/lib/celerity/elements/table.rb +141 -94
- data/lib/celerity/elements/table_cell.rb +13 -6
- data/lib/celerity/elements/{table_body.rb → table_elements.rb} +20 -8
- data/lib/celerity/elements/table_row.rb +23 -7
- data/lib/celerity/elements/text_field.rb +89 -33
- data/lib/celerity/exception.rb +77 -41
- data/lib/celerity/extra/method_generator.rb +42 -24
- data/lib/celerity/htmlunit.rb +49 -0
- data/lib/celerity/htmlunit/commons-collections-3.2.1.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-2.5-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.5-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/nekohtml-1.9.12-20090308.130127-11.jar +0 -0
- data/lib/celerity/htmlunit/serializer-2.7.1.jar +0 -0
- data/lib/celerity/htmlunit/xalan-2.7.1.jar +0 -0
- data/lib/celerity/htmlunit/xml-apis-1.3.04.jar +0 -0
- data/lib/celerity/identifier.rb +3 -2
- data/lib/celerity/input_element.rb +5 -5
- data/lib/celerity/listener.rb +135 -0
- data/lib/celerity/resources/no_viewer.png +0 -0
- data/lib/celerity/util.rb +88 -0
- data/lib/celerity/version.rb +4 -3
- data/lib/celerity/watir_compatibility.rb +35 -25
- data/tasks/jar.rake +57 -0
- metadata +35 -142
- data.tar.gz.sig +0 -0
- data/Manifest.txt +0 -150
- data/lib/celerity/element_collections.rb +0 -54
- data/lib/celerity/element_map.rb +0 -51
- data/lib/celerity/elements/table_footer.rb +0 -30
- data/lib/celerity/elements/table_header.rb +0 -30
- data/lib/celerity/htmlunit/commons-collections-3.2.jar +0 -0
- data/lib/celerity/htmlunit/download.sh +0 -23
- data/lib/celerity/htmlunit/htmlunit-2.2.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.2.jar +0 -0
- data/lib/celerity/htmlunit/nekohtml-1.9.8.jar +0 -0
- data/lib/celerity/htmlunit/xalan-2.7.0.jar +0 -0
- data/lib/celerity/htmlunit/xml-apis-1.0.b2.jar +0 -0
- data/spec/area_spec.rb +0 -97
- data/spec/areas_spec.rb +0 -40
- data/spec/browser_spec.rb +0 -266
- data/spec/button_spec.rb +0 -227
- data/spec/buttons_spec.rb +0 -39
- data/spec/checkbox_spec.rb +0 -302
- data/spec/checkboxes_spec.rb +0 -38
- data/spec/div_spec.rb +0 -207
- data/spec/divs_spec.rb +0 -39
- data/spec/element_spec.rb +0 -79
- data/spec/filefield_spec.rb +0 -123
- data/spec/filefields_spec.rb +0 -40
- data/spec/form_spec.rb +0 -59
- data/spec/forms_spec.rb +0 -41
- data/spec/frame_spec.rb +0 -121
- data/spec/frames_spec.rb +0 -71
- data/spec/hidden_spec.rb +0 -127
- data/spec/hiddens_spec.rb +0 -39
- data/spec/hn_spec.rb +0 -104
- data/spec/hns_spec.rb +0 -45
- data/spec/html/2000_spans.html +0 -2009
- data/spec/html/bug_duplicate_attributes.html +0 -14
- data/spec/html/bug_javascript_001.html +0 -11
- data/spec/html/form_js_bug.html +0 -11
- data/spec/html/forms_with_input_elements.html +0 -114
- data/spec/html/frame_1.html +0 -17
- data/spec/html/frame_2.html +0 -16
- data/spec/html/frames.html +0 -11
- data/spec/html/iframes.html +0 -12
- data/spec/html/images.html +0 -27
- data/spec/html/images/1.gif +0 -0
- data/spec/html/images/2.gif +0 -0
- data/spec/html/images/3.gif +0 -0
- data/spec/html/images/button.jpg +0 -0
- data/spec/html/images/circle.jpg +0 -0
- data/spec/html/images/map.gif +0 -0
- data/spec/html/images/map2.gif +0 -0
- data/spec/html/images/minus.gif +0 -0
- data/spec/html/images/originaltriangle.jpg +0 -0
- data/spec/html/images/plus.gif +0 -0
- data/spec/html/images/square.jpg +0 -0
- data/spec/html/images/triangle.jpg +0 -0
- data/spec/html/invalid_js.html +0 -11
- data/spec/html/latin1_text.html +0 -17
- data/spec/html/non_control_elements.html +0 -115
- data/spec/html/simple_ajax.html +0 -22
- data/spec/html/tables.html +0 -119
- data/spec/html/utf8_text.html +0 -15
- data/spec/htmlunit_spec.rb +0 -26
- data/spec/image_spec.rb +0 -220
- data/spec/images_spec.rb +0 -39
- data/spec/label_spec.rb +0 -79
- data/spec/labels_spec.rb +0 -40
- data/spec/li_spec.rb +0 -139
- data/spec/link_spec.rb +0 -189
- data/spec/links_spec.rb +0 -43
- data/spec/lis_spec.rb +0 -40
- data/spec/map_spec.rb +0 -102
- data/spec/maps_spec.rb +0 -40
- data/spec/meta_spec.rb +0 -8
- data/spec/ol_spec.rb +0 -87
- data/spec/ols_spec.rb +0 -40
- data/spec/option_spec.rb +0 -154
- data/spec/p_spec.rb +0 -171
- data/spec/pre_spec.rb +0 -135
- data/spec/pres_spec.rb +0 -40
- data/spec/ps_spec.rb +0 -40
- data/spec/radio_spec.rb +0 -299
- data/spec/radios_spec.rb +0 -42
- data/spec/select_list_spec.rb +0 -299
- data/spec/select_lists_spec.rb +0 -47
- data/spec/span_spec.rb +0 -184
- data/spec/spans_spec.rb +0 -64
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -55
- data/spec/table_bodies_spec.rb +0 -57
- data/spec/table_body_spec.rb +0 -111
- data/spec/table_cell_spec.rb +0 -74
- data/spec/table_cells_spec.rb +0 -59
- data/spec/table_footer_spec.rb +0 -101
- data/spec/table_footers_spec.rb +0 -55
- data/spec/table_header_spec.rb +0 -101
- data/spec/table_headers_spec.rb +0 -55
- data/spec/table_row_spec.rb +0 -104
- data/spec/table_rows_spec.rb +0 -58
- data/spec/table_spec.rb +0 -160
- data/spec/tables_spec.rb +0 -42
- data/spec/text_field_spec.rb +0 -323
- data/spec/text_fields_spec.rb +0 -44
- data/spec/ul_spec.rb +0 -88
- data/spec/uls_spec.rb +0 -40
- data/spec/watir_compatibility_spec.rb +0 -260
- data/support/spec_server.rb +0 -73
- data/tasks/rspec.rake +0 -30
- data/tasks/specserver.rake +0 -21
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Celerity
|
|
2
|
+
Jars = Dir[File.dirname(__FILE__) + '/htmlunit/*.jar']
|
|
3
|
+
Jars.each { |jar| require(jar) }
|
|
4
|
+
|
|
5
|
+
include_class org.apache.commons.httpclient.Cookie
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
module HtmlUnit
|
|
11
|
+
include_package 'com.gargoylesoftware.htmlunit'
|
|
12
|
+
|
|
13
|
+
module Html
|
|
14
|
+
include_package 'com.gargoylesoftware.htmlunit.html'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
module Util
|
|
18
|
+
include_package 'com.gargoylesoftware.htmlunit.util'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
module Java::OrgW3cDom::NamedNodeMap
|
|
24
|
+
include Enumerable
|
|
25
|
+
|
|
26
|
+
def each
|
|
27
|
+
0.upto(getLength - 1) do |idx|
|
|
28
|
+
yield item(idx)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
module Java::JavaLang::Iterable
|
|
34
|
+
include Enumerable
|
|
35
|
+
|
|
36
|
+
def each
|
|
37
|
+
it = iterator
|
|
38
|
+
yield it.next while it.hasNext
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Java::ComGargoylesoftwareHtmlunitHtml::HtmlPage
|
|
45
|
+
def inspect
|
|
46
|
+
'#<HtmlPage:0x%s(%s)>' % [self.hash.to_s(16), getWebResponse.getUrl.toString]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/celerity/identifier.rb
CHANGED
|
@@ -3,10 +3,10 @@ module Celerity
|
|
|
3
3
|
include ClickableElement
|
|
4
4
|
include DisabledElement
|
|
5
5
|
|
|
6
|
-
ATTRIBUTES = BASE_ATTRIBUTES | [:type, :name, :value, :checked, :disabled, :readonly, :size, :maxlength,
|
|
7
|
-
:src, :alt, :usemap, :ismap, :tabindex, :accesskey, :onfocus, :onblur,
|
|
8
|
-
:onselect, :onchange, :accept, :align]
|
|
9
|
-
|
|
6
|
+
ATTRIBUTES = BASE_ATTRIBUTES | [:type, :name, :value, :checked, :disabled, :readonly, :size, :maxlength,
|
|
7
|
+
:src, :alt, :usemap, :ismap, :tabindex, :accesskey, :onfocus, :onblur,
|
|
8
|
+
:onselect, :onchange, :accept, :align]
|
|
9
|
+
|
|
10
10
|
def readonly?
|
|
11
11
|
assert_exists
|
|
12
12
|
@object.isAttributeDefined('readonly')
|
|
@@ -17,7 +17,7 @@ module Celerity
|
|
|
17
17
|
def assert_not_readonly
|
|
18
18
|
if readonly?
|
|
19
19
|
raise ObjectReadOnlyException,
|
|
20
|
-
"InputElement #{identifier_string
|
|
20
|
+
"InputElement #{identifier_string} is read only."
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
module Celerity
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# This class is used to wrap some of the listeners available from HtmlUnit's WebClient.
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
class Listener
|
|
8
|
+
include com.gargoylesoftware.htmlunit.AlertHandler
|
|
9
|
+
include com.gargoylesoftware.htmlunit.ConfirmHandler
|
|
10
|
+
include com.gargoylesoftware.htmlunit.PromptHandler
|
|
11
|
+
include com.gargoylesoftware.htmlunit.html.HTMLParserListener
|
|
12
|
+
include com.gargoylesoftware.htmlunit.IncorrectnessListener
|
|
13
|
+
include com.gargoylesoftware.htmlunit.StatusHandler
|
|
14
|
+
include com.gargoylesoftware.htmlunit.WebWindowListener
|
|
15
|
+
include com.gargoylesoftware.htmlunit.attachment.AttachmentHandler
|
|
16
|
+
|
|
17
|
+
def initialize(webclient)
|
|
18
|
+
@webclient = webclient
|
|
19
|
+
@procs = Hash.new { |h, k| h[k] = [] }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
#
|
|
23
|
+
# Add a listener block for one of the available types.
|
|
24
|
+
# @see Celerity::Browser#add_listener
|
|
25
|
+
#
|
|
26
|
+
|
|
27
|
+
def add_listener(type, &block)
|
|
28
|
+
case type
|
|
29
|
+
when :status
|
|
30
|
+
@webclient.setStatusHandler(self)
|
|
31
|
+
when :alert
|
|
32
|
+
@webclient.setAlertHandler(self)
|
|
33
|
+
when :attachment
|
|
34
|
+
@webclient.setAttachmentHandler(self)
|
|
35
|
+
when :web_window_event
|
|
36
|
+
@webclient.addWebWindowListener(self)
|
|
37
|
+
when :html_parser
|
|
38
|
+
@webclient.setHTMLParserListener(self)
|
|
39
|
+
when :incorrectness
|
|
40
|
+
@webclient.setIncorrectnessListener(self)
|
|
41
|
+
when :confirm
|
|
42
|
+
@webclient.setConfirmHandler(self)
|
|
43
|
+
when :prompt
|
|
44
|
+
@webclient.setPromptHandler(self)
|
|
45
|
+
else
|
|
46
|
+
raise ArgumentError, "unknown listener type #{type.inspect}"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
@procs[type] << block
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def remove_listener(type, proc_or_index)
|
|
53
|
+
unless @procs.has_key?(type)
|
|
54
|
+
raise ArgumentError, "unknown listener type #{type.inspect}"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
case proc_or_index
|
|
58
|
+
when Fixnum
|
|
59
|
+
@procs[type].delete_at proc_or_index
|
|
60
|
+
when Proc
|
|
61
|
+
@procs[type].delete proc_or_index
|
|
62
|
+
else
|
|
63
|
+
raise TypeError, "must give proc or index"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
#
|
|
68
|
+
# interface StatusHandler
|
|
69
|
+
#
|
|
70
|
+
|
|
71
|
+
def statusMessageChanged(page, message)
|
|
72
|
+
@procs[:status].each { |h| h.call(page, message) }
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
#
|
|
76
|
+
# interface AlertHandler
|
|
77
|
+
#
|
|
78
|
+
|
|
79
|
+
def handleAlert(page, message)
|
|
80
|
+
@procs[:alert].each { |h| h.call(page, message) }
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
#
|
|
84
|
+
# interface ConfirmHandler
|
|
85
|
+
#
|
|
86
|
+
|
|
87
|
+
def handleConfirm(page, message)
|
|
88
|
+
@procs[:confirm].each { |h| h.call(page, message) }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
#
|
|
92
|
+
# interface AttachmentHandler
|
|
93
|
+
#
|
|
94
|
+
|
|
95
|
+
def handleAttachment(page)
|
|
96
|
+
@procs[:attachment].each { |h| h.call(page) }
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
#
|
|
100
|
+
# interface PromptHandler
|
|
101
|
+
#
|
|
102
|
+
|
|
103
|
+
def handlePrompt(page, message)
|
|
104
|
+
@procs[:prompt].each { |h| h.call(page, message) }
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
#
|
|
108
|
+
# interface WebWindowListener
|
|
109
|
+
#
|
|
110
|
+
|
|
111
|
+
def webWindowClosed(web_window_event)
|
|
112
|
+
@procs[:web_window_event].each { |h| h.call(web_window_event) }
|
|
113
|
+
end
|
|
114
|
+
alias_method :webWindowOpened, :webWindowClosed
|
|
115
|
+
alias_method :webWindowContentChanged, :webWindowClosed
|
|
116
|
+
|
|
117
|
+
#
|
|
118
|
+
# interface HTMLParserListener
|
|
119
|
+
#
|
|
120
|
+
|
|
121
|
+
def error(message, url, line, column, key)
|
|
122
|
+
@procs[:html_parser].each { |h| h.call(message, url, line, column, key) }
|
|
123
|
+
end
|
|
124
|
+
alias_method :warning, :error
|
|
125
|
+
|
|
126
|
+
#
|
|
127
|
+
# interface IncorrectnessListener
|
|
128
|
+
#
|
|
129
|
+
|
|
130
|
+
def notify(message, origin)
|
|
131
|
+
@procs[:incorrectness].each { |h| h.call(message, origin) }
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
end # Listener
|
|
135
|
+
end # Celerity
|
|
Binary file
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
module Celerity
|
|
2
|
+
module Util
|
|
3
|
+
module_function
|
|
4
|
+
|
|
5
|
+
HtmlUnit2CelerityElement = {
|
|
6
|
+
HtmlUnit::Html::HtmlAnchor => Celerity::Link,
|
|
7
|
+
HtmlUnit::Html::HtmlArea => Celerity::Area,
|
|
8
|
+
HtmlUnit::Html::HtmlButton => Celerity::Button,
|
|
9
|
+
HtmlUnit::Html::HtmlSubmitInput => Celerity::Button,
|
|
10
|
+
HtmlUnit::Html::HtmlResetInput => Celerity::Button,
|
|
11
|
+
HtmlUnit::Html::HtmlImageInput => Celerity::Button,
|
|
12
|
+
HtmlUnit::Html::HtmlButtonInput => Celerity::Button,
|
|
13
|
+
HtmlUnit::Html::HtmlCaption => Celerity::Button, # ?
|
|
14
|
+
HtmlUnit::Html::HtmlCheckBoxInput => Celerity::CheckBox,
|
|
15
|
+
HtmlUnit::Html::HtmlDefinitionDescription => Celerity::Dd,
|
|
16
|
+
HtmlUnit::Html::HtmlDefinitionList => Celerity::Dl,
|
|
17
|
+
HtmlUnit::Html::HtmlDefinitionTerm => Celerity::Dt,
|
|
18
|
+
HtmlUnit::Html::HtmlDivision => Celerity::Div,
|
|
19
|
+
HtmlUnit::Html::HtmlFileInput => Celerity::FileField,
|
|
20
|
+
HtmlUnit::Html::HtmlForm => Celerity::Form,
|
|
21
|
+
HtmlUnit::Html::HtmlFrame => Celerity::Frame,
|
|
22
|
+
HtmlUnit::Html::HtmlHeading1 => Celerity::H1,
|
|
23
|
+
HtmlUnit::Html::HtmlHeading2 => Celerity::H2,
|
|
24
|
+
HtmlUnit::Html::HtmlHeading3 => Celerity::H3,
|
|
25
|
+
HtmlUnit::Html::HtmlHeading4 => Celerity::H4,
|
|
26
|
+
HtmlUnit::Html::HtmlHeading5 => Celerity::H5,
|
|
27
|
+
HtmlUnit::Html::HtmlHeading6 => Celerity::H6,
|
|
28
|
+
HtmlUnit::Html::HtmlHiddenInput => Celerity::Hidden,
|
|
29
|
+
HtmlUnit::Html::HtmlImage => Celerity::Image,
|
|
30
|
+
HtmlUnit::Html::HtmlLabel => Celerity::Label,
|
|
31
|
+
HtmlUnit::Html::HtmlLink => Celerity::Link,
|
|
32
|
+
HtmlUnit::Html::HtmlListItem => Celerity::Li,
|
|
33
|
+
HtmlUnit::Html::HtmlMap => Celerity::Map,
|
|
34
|
+
HtmlUnit::Html::HtmlOption => Celerity::Option,
|
|
35
|
+
HtmlUnit::Html::HtmlOrderedList => Celerity::Ol,
|
|
36
|
+
HtmlUnit::Html::HtmlParagraph => Celerity::P,
|
|
37
|
+
HtmlUnit::Html::HtmlPasswordInput => Celerity::TextField,
|
|
38
|
+
HtmlUnit::Html::HtmlPreformattedText => Celerity::Pre,
|
|
39
|
+
HtmlUnit::Html::HtmlRadioButtonInput => Celerity::Radio,
|
|
40
|
+
HtmlUnit::Html::HtmlSelect => Celerity::SelectList,
|
|
41
|
+
HtmlUnit::Html::HtmlSpan => Celerity::Span,
|
|
42
|
+
HtmlUnit::Html::HtmlTable => Celerity::Table,
|
|
43
|
+
HtmlUnit::Html::HtmlTableBody => Celerity::TableBody,
|
|
44
|
+
HtmlUnit::Html::HtmlTableCell => Celerity::TableCell,
|
|
45
|
+
HtmlUnit::Html::HtmlTableFooter => Celerity::TableFooter,
|
|
46
|
+
HtmlUnit::Html::HtmlTableHeader => Celerity::TableHeader,
|
|
47
|
+
HtmlUnit::Html::HtmlTableRow => Celerity::TableRow,
|
|
48
|
+
HtmlUnit::Html::HtmlTextArea => Celerity::TextField,
|
|
49
|
+
HtmlUnit::Html::HtmlTextInput => Celerity::TextField,
|
|
50
|
+
HtmlUnit::Html::HtmlUnorderedList => Celerity::Ul
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
def htmlunit2celerity(klass)
|
|
54
|
+
HtmlUnit2CelerityElement[klass]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
#
|
|
58
|
+
# HtmlUnit will recognize most common file types, but custom ones can be added here.
|
|
59
|
+
# Used for FileField uploads.
|
|
60
|
+
#
|
|
61
|
+
|
|
62
|
+
ContentTypes = {
|
|
63
|
+
".bmp" => "image/x-ms-bmp",
|
|
64
|
+
".doc" => "application/msword",
|
|
65
|
+
".odg" => "application/vnd.oasis.opendocument.graphics",
|
|
66
|
+
".odp" => "application/vnd.oasis.opendocument.presentation",
|
|
67
|
+
".ods" => "application/vnd.oasis.opendocument.spreadsheet",
|
|
68
|
+
".odt" => "application/vnd.oasis.opendocument.text",
|
|
69
|
+
".ppt" => "application/vnd.ms-powerpoint",
|
|
70
|
+
".xls" => "application/vnd.ms-excel",
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
def content_type_for(path)
|
|
74
|
+
if ct = java.net.URLConnection.getFileNameMap.getContentTypeFor(path)
|
|
75
|
+
return ct
|
|
76
|
+
else
|
|
77
|
+
ContentTypes[File.extname(path).downcase]
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def normalize_text(string)
|
|
82
|
+
string.gsub("\302\240", ' '). # non-breaking space 00A0
|
|
83
|
+
gsub(/\n|\t/, ''). # get rid of newlines/tabs
|
|
84
|
+
strip
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
end
|
data/lib/celerity/version.rb
CHANGED
|
@@ -2,8 +2,9 @@ module Celerity #:nodoc:
|
|
|
2
2
|
module VERSION #:nodoc:
|
|
3
3
|
MAJOR = 0
|
|
4
4
|
MINOR = 0
|
|
5
|
-
TINY =
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
TINY = 6
|
|
6
|
+
PATCH = nil # Set to nil for official release
|
|
7
|
+
|
|
8
|
+
STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
|
|
8
9
|
end
|
|
9
10
|
end
|
|
@@ -1,75 +1,85 @@
|
|
|
1
1
|
module Celerity
|
|
2
2
|
class Browser
|
|
3
3
|
class << self
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
5
6
|
attr_accessor :speed, :attach_timeout, :visible
|
|
6
|
-
#
|
|
7
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
7
8
|
alias_method :start_window, :start
|
|
8
|
-
#
|
|
9
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
9
10
|
def reset_attach_timeout; @attach_timeout = 2.0; end
|
|
10
|
-
#
|
|
11
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
11
12
|
def each; end
|
|
12
|
-
#
|
|
13
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
13
14
|
def quit; end
|
|
14
|
-
#
|
|
15
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
15
16
|
def set_fast_speed; @speed = :fast; end
|
|
16
|
-
#
|
|
17
|
-
def set_slow_speed; @speed = :slow; end
|
|
17
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
18
|
+
def set_slow_speed; @speed = :slow; end
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
#
|
|
21
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
21
22
|
attr_accessor :visible
|
|
22
|
-
|
|
23
|
-
#
|
|
23
|
+
|
|
24
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
24
25
|
def bring_to_front; true; end
|
|
25
|
-
#
|
|
26
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
26
27
|
def speed=(s); s end
|
|
27
|
-
#
|
|
28
|
-
def
|
|
28
|
+
# Added for Watir compatibility - not in use by Celerity
|
|
29
|
+
def status; '' end
|
|
29
30
|
end
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
|
|
32
33
|
module ClickableElement
|
|
33
34
|
alias_method :click_no_wait, :click
|
|
34
35
|
end
|
|
35
|
-
|
|
36
|
+
|
|
36
37
|
module Container
|
|
37
38
|
alias_method :checkbox, :check_box
|
|
38
39
|
alias_method :checkBox, :check_box
|
|
39
40
|
alias_method :body, :tbody
|
|
40
41
|
alias_method :bodies, :tbodies
|
|
41
42
|
end
|
|
42
|
-
|
|
43
|
+
|
|
44
|
+
class Element
|
|
45
|
+
alias_method :exists, :exists?
|
|
46
|
+
alias_method :innerText, :text
|
|
47
|
+
alias_method :inner_text, :text
|
|
48
|
+
end
|
|
49
|
+
|
|
43
50
|
class Image
|
|
44
51
|
alias_method :hasLoaded?, :loaded?
|
|
45
52
|
alias_method :has_loaded?, :loaded?
|
|
46
53
|
alias_method :fileSize, :file_size
|
|
47
54
|
alias_method :fileCreatedDate, :file_created_date
|
|
48
55
|
end
|
|
49
|
-
|
|
56
|
+
|
|
50
57
|
class Link
|
|
51
58
|
alias_method :click_no_wait, :click
|
|
52
59
|
end
|
|
53
|
-
|
|
60
|
+
|
|
54
61
|
class RadioCheckCommon
|
|
55
62
|
alias_method :is_set?, :set?
|
|
56
63
|
alias_method :get_state, :set?
|
|
57
64
|
alias_method :isSet?, :set?
|
|
58
65
|
alias_method :getState, :set?
|
|
59
66
|
end
|
|
60
|
-
|
|
67
|
+
|
|
61
68
|
class SelectList
|
|
62
|
-
alias_method :getSelectedItems, :
|
|
63
|
-
alias_method :getAllContents, :
|
|
64
|
-
alias_method :clearSelection, :
|
|
69
|
+
alias_method :getSelectedItems, :selected_options
|
|
70
|
+
alias_method :getAllContents, :options
|
|
71
|
+
alias_method :clearSelection, :clear
|
|
72
|
+
alias_method :clear_selection, :clear
|
|
65
73
|
alias_method :select_value, :select
|
|
66
74
|
alias_method :includes?, :include?
|
|
67
75
|
end
|
|
68
|
-
|
|
76
|
+
|
|
69
77
|
class TextField
|
|
70
78
|
alias_method :dragContentsTo, :drag_contents_to
|
|
71
79
|
alias_method :getContents, :value
|
|
72
80
|
alias_method :get_contents, :value
|
|
81
|
+
|
|
82
|
+
def requires_typing; end
|
|
73
83
|
end
|
|
74
84
|
end
|
|
75
85
|
|