oki-celerity 0.8.1.dev
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +111 -0
- data/LICENSE +621 -0
- data/README.rdoc +80 -0
- data/Rakefile +11 -0
- data/VERSION.yml +5 -0
- data/celerity.gemspec +126 -0
- data/lib/celerity/browser.rb +908 -0
- data/lib/celerity/clickable_element.rb +73 -0
- data/lib/celerity/collections.rb +164 -0
- data/lib/celerity/container.rb +800 -0
- data/lib/celerity/default_viewer.rb +14 -0
- data/lib/celerity/disabled_element.rb +40 -0
- data/lib/celerity/element.rb +311 -0
- data/lib/celerity/element_collection.rb +107 -0
- data/lib/celerity/element_locator.rb +164 -0
- data/lib/celerity/elements/button.rb +54 -0
- data/lib/celerity/elements/file_field.rb +29 -0
- data/lib/celerity/elements/form.rb +22 -0
- data/lib/celerity/elements/frame.rb +86 -0
- data/lib/celerity/elements/image.rb +89 -0
- data/lib/celerity/elements/label.rb +16 -0
- data/lib/celerity/elements/link.rb +43 -0
- data/lib/celerity/elements/meta.rb +14 -0
- data/lib/celerity/elements/non_control_elements.rb +124 -0
- data/lib/celerity/elements/option.rb +38 -0
- data/lib/celerity/elements/radio_check.rb +114 -0
- data/lib/celerity/elements/select_list.rb +146 -0
- data/lib/celerity/elements/table.rb +153 -0
- data/lib/celerity/elements/table_cell.rb +36 -0
- data/lib/celerity/elements/table_elements.rb +42 -0
- data/lib/celerity/elements/table_row.rb +49 -0
- data/lib/celerity/elements/text_field.rb +168 -0
- data/lib/celerity/exception.rb +83 -0
- data/lib/celerity/htmlunit/apache-mime4j-0.6.jar +0 -0
- data/lib/celerity/htmlunit/commons-codec-1.4.jar +0 -0
- data/lib/celerity/htmlunit/commons-collections-3.2.1.jar +0 -0
- data/lib/celerity/htmlunit/commons-io-1.4.jar +0 -0
- data/lib/celerity/htmlunit/commons-lang-2.5.jar +0 -0
- data/lib/celerity/htmlunit/commons-logging-1.1.1.jar +0 -0
- data/lib/celerity/htmlunit/cssparser-0.9.5.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-2.9-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.8.jar +0 -0
- data/lib/celerity/htmlunit/httpclient-4.0.1.jar +0 -0
- data/lib/celerity/htmlunit/httpcore-4.0.1.jar +0 -0
- data/lib/celerity/htmlunit/httpmime-4.0.1.jar +0 -0
- data/lib/celerity/htmlunit/nekohtml-1.9.14.jar +0 -0
- data/lib/celerity/htmlunit/sac-1.3.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/xercesImpl-2.9.1.jar +0 -0
- data/lib/celerity/htmlunit/xml-apis-1.3.04.jar +0 -0
- data/lib/celerity/htmlunit.rb +64 -0
- data/lib/celerity/identifier.rb +28 -0
- data/lib/celerity/ignoring_web_connection.rb +15 -0
- data/lib/celerity/input_element.rb +25 -0
- data/lib/celerity/javascript_debugger.rb +32 -0
- data/lib/celerity/listener.rb +143 -0
- data/lib/celerity/resources/no_viewer.png +0 -0
- data/lib/celerity/short_inspect.rb +20 -0
- data/lib/celerity/util.rb +129 -0
- data/lib/celerity/version.rb +3 -0
- data/lib/celerity/viewer_connection.rb +89 -0
- data/lib/celerity/watir_compatibility.rb +70 -0
- data/lib/celerity/xpath_support.rb +52 -0
- data/lib/celerity.rb +77 -0
- data/tasks/benchmark.rake +4 -0
- data/tasks/check.rake +24 -0
- data/tasks/clean.rake +3 -0
- data/tasks/fix.rake +25 -0
- data/tasks/jar.rake +55 -0
- data/tasks/jeweler.rake +28 -0
- data/tasks/rdoc.rake +4 -0
- data/tasks/snapshot.rake +25 -0
- data/tasks/spec.rake +26 -0
- data/tasks/website.rake +10 -0
- data/tasks/yard.rake +16 -0
- metadata +204 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
module Celerity
|
2
|
+
module ClickableElement
|
3
|
+
|
4
|
+
#
|
5
|
+
# click the element
|
6
|
+
#
|
7
|
+
|
8
|
+
def click
|
9
|
+
assert_exists_and_enabled
|
10
|
+
rescue_status_code_exception { @object.click }
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# double click the element (Celerity only)
|
15
|
+
#
|
16
|
+
|
17
|
+
def double_click
|
18
|
+
assert_exists_and_enabled
|
19
|
+
rescue_status_code_exception { @object.dblClick }
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# right click the element (Celerity only)
|
24
|
+
#
|
25
|
+
|
26
|
+
def right_click
|
27
|
+
assert_exists_and_enabled
|
28
|
+
rescue_status_code_exception { @object.rightClick }
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Click the element and return a new Browser instance with the resulting page.
|
33
|
+
# This is useful for elements that trigger popups when clicked.
|
34
|
+
#
|
35
|
+
# @return [Celerity::Browser]
|
36
|
+
#
|
37
|
+
|
38
|
+
def click_and_attach
|
39
|
+
assert_exists_and_enabled
|
40
|
+
browser = Browser.new(@browser.options.dup)
|
41
|
+
browser.webclient.set_cookie_manager(
|
42
|
+
@browser.webclient.get_cookie_manager
|
43
|
+
) # hirobumi: we do want cookies as well.
|
44
|
+
|
45
|
+
@browser.disable_event_listener do
|
46
|
+
rescue_status_code_exception { browser.page = @object.click }
|
47
|
+
end
|
48
|
+
|
49
|
+
browser
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Click the element and just return the content as IO. Current page stays unchanged.
|
54
|
+
# This can be used to download content that normally isn't rendered in a browser.
|
55
|
+
#
|
56
|
+
# @return [IO]
|
57
|
+
#
|
58
|
+
|
59
|
+
def download
|
60
|
+
assert_exists_and_enabled
|
61
|
+
@browser.disable_event_listener do
|
62
|
+
@object.click.getWebResponse.getContentAsStream.to_io
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def assert_exists_and_enabled
|
69
|
+
assert_exists
|
70
|
+
assert_enabled if respond_to?(:assert_enabled)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
module Celerity
|
2
|
+
|
3
|
+
class Frames < ElementCollection
|
4
|
+
def element_class; Frame; end
|
5
|
+
end
|
6
|
+
|
7
|
+
class Buttons < ElementCollection
|
8
|
+
def element_class; Button; end
|
9
|
+
end
|
10
|
+
|
11
|
+
class FileFields < ElementCollection
|
12
|
+
def element_class; FileField; end
|
13
|
+
end
|
14
|
+
|
15
|
+
class CheckBoxes < ElementCollection
|
16
|
+
def element_class; CheckBox; end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Radios < ElementCollection
|
20
|
+
def element_class; Radio; end
|
21
|
+
end
|
22
|
+
|
23
|
+
class SelectLists < ElementCollection
|
24
|
+
def element_class; SelectList; end
|
25
|
+
end
|
26
|
+
|
27
|
+
class Links < ElementCollection
|
28
|
+
def element_class; Link; end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Uls < ElementCollection
|
32
|
+
def element_class; Ul; end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Ols < ElementCollection
|
36
|
+
def element_class; Ol; end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Lis < ElementCollection
|
40
|
+
def element_class; Li; end
|
41
|
+
end
|
42
|
+
|
43
|
+
class Dds < ElementCollection
|
44
|
+
def element_class; Dd; end
|
45
|
+
end
|
46
|
+
|
47
|
+
class Dls < ElementCollection
|
48
|
+
def element_class; Dl; end
|
49
|
+
end
|
50
|
+
|
51
|
+
class Dts < ElementCollection
|
52
|
+
def element_class; Dt; end
|
53
|
+
end
|
54
|
+
|
55
|
+
class Ems < ElementCollection
|
56
|
+
def element_class; Em; end
|
57
|
+
end
|
58
|
+
|
59
|
+
class Maps < ElementCollection
|
60
|
+
def element_class; Map; end
|
61
|
+
end
|
62
|
+
|
63
|
+
class Areas < ElementCollection
|
64
|
+
def element_class; Area; end
|
65
|
+
end
|
66
|
+
|
67
|
+
class Images < ElementCollection
|
68
|
+
def element_class; Image; end
|
69
|
+
end
|
70
|
+
|
71
|
+
class TextFields < ElementCollection
|
72
|
+
def element_class; TextField; end
|
73
|
+
end
|
74
|
+
|
75
|
+
class Hiddens < ElementCollection
|
76
|
+
def element_class; Hidden; end
|
77
|
+
end
|
78
|
+
|
79
|
+
class Tables < ElementCollection
|
80
|
+
def element_class; Table; end
|
81
|
+
end
|
82
|
+
|
83
|
+
class TableHeaders < ElementCollection
|
84
|
+
def element_class; TableHeader; end
|
85
|
+
end
|
86
|
+
class TableBodies < ElementCollection
|
87
|
+
def element_class; TableBody; end
|
88
|
+
end
|
89
|
+
class TableFooters < ElementCollection
|
90
|
+
def element_class; TableFooter; end
|
91
|
+
end
|
92
|
+
|
93
|
+
class TableRows < ElementCollection
|
94
|
+
def element_class; TableRow; end
|
95
|
+
end
|
96
|
+
|
97
|
+
class TableCells < ElementCollection
|
98
|
+
def element_class; TableCell; end
|
99
|
+
end
|
100
|
+
|
101
|
+
class Labels < ElementCollection
|
102
|
+
def element_class; Label; end
|
103
|
+
end
|
104
|
+
|
105
|
+
class Pres < ElementCollection
|
106
|
+
def element_class; Pre; end
|
107
|
+
end
|
108
|
+
|
109
|
+
class Ps < ElementCollection
|
110
|
+
def element_class; P; end
|
111
|
+
end
|
112
|
+
|
113
|
+
class Spans < ElementCollection
|
114
|
+
def element_class; Span; end
|
115
|
+
end
|
116
|
+
|
117
|
+
class Strongs < ElementCollection
|
118
|
+
def element_class; Strong; end
|
119
|
+
end
|
120
|
+
|
121
|
+
class Divs < ElementCollection
|
122
|
+
def element_class; Div; end
|
123
|
+
end
|
124
|
+
|
125
|
+
class Forms < ElementCollection
|
126
|
+
def element_class; Form; end
|
127
|
+
end
|
128
|
+
|
129
|
+
class Options < ElementCollection
|
130
|
+
def element_class; Option; end
|
131
|
+
end
|
132
|
+
|
133
|
+
class Metas < ElementCollection
|
134
|
+
def element_class; Meta; end
|
135
|
+
end
|
136
|
+
|
137
|
+
class H1s < ElementCollection
|
138
|
+
def element_class; H1; end
|
139
|
+
end
|
140
|
+
class H2s < ElementCollection
|
141
|
+
def element_class; H2; end
|
142
|
+
end
|
143
|
+
class H3s < ElementCollection
|
144
|
+
def element_class; H3; end
|
145
|
+
end
|
146
|
+
class H4s < ElementCollection
|
147
|
+
def element_class; H4; end
|
148
|
+
end
|
149
|
+
class H5s < ElementCollection
|
150
|
+
def element_class; H5; end
|
151
|
+
end
|
152
|
+
class H6s < ElementCollection
|
153
|
+
def element_class; H6; end
|
154
|
+
end
|
155
|
+
|
156
|
+
class Inses < ElementCollection
|
157
|
+
def element_class; Ins; end
|
158
|
+
end
|
159
|
+
|
160
|
+
class Dels < ElementCollection
|
161
|
+
def element_class; Del; end
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|