bbc-selenium-webdriver 1.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/CHANGES +473 -0
  2. data/README +31 -0
  3. data/lib/selenium-client.rb +2 -0
  4. data/lib/selenium-webdriver.rb +1 -0
  5. data/lib/selenium/client.rb +37 -0
  6. data/lib/selenium/client/base.rb +118 -0
  7. data/lib/selenium/client/driver.rb +10 -0
  8. data/lib/selenium/client/errors.rb +9 -0
  9. data/lib/selenium/client/extensions.rb +118 -0
  10. data/lib/selenium/client/idiomatic.rb +488 -0
  11. data/lib/selenium/client/javascript_expression_builder.rb +116 -0
  12. data/lib/selenium/client/javascript_frameworks/jquery.rb +13 -0
  13. data/lib/selenium/client/javascript_frameworks/prototype.rb +13 -0
  14. data/lib/selenium/client/legacy_driver.rb +1720 -0
  15. data/lib/selenium/client/protocol.rb +104 -0
  16. data/lib/selenium/client/selenium_helper.rb +34 -0
  17. data/lib/selenium/rake/server_task.rb +157 -0
  18. data/lib/selenium/server.rb +223 -0
  19. data/lib/selenium/webdriver.rb +64 -0
  20. data/lib/selenium/webdriver/android.rb +9 -0
  21. data/lib/selenium/webdriver/android/bridge.rb +51 -0
  22. data/lib/selenium/webdriver/chrome.rb +26 -0
  23. data/lib/selenium/webdriver/chrome/bridge.rb +106 -0
  24. data/lib/selenium/webdriver/chrome/profile.rb +83 -0
  25. data/lib/selenium/webdriver/chrome/service.rb +74 -0
  26. data/lib/selenium/webdriver/common.rb +30 -0
  27. data/lib/selenium/webdriver/common/action_builder.rb +352 -0
  28. data/lib/selenium/webdriver/common/alert.rb +26 -0
  29. data/lib/selenium/webdriver/common/bridge_helper.rb +67 -0
  30. data/lib/selenium/webdriver/common/core_ext/base64.rb +9 -0
  31. data/lib/selenium/webdriver/common/core_ext/dir.rb +42 -0
  32. data/lib/selenium/webdriver/common/core_ext/string.rb +5 -0
  33. data/lib/selenium/webdriver/common/driver.rb +301 -0
  34. data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +39 -0
  35. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +44 -0
  36. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +43 -0
  37. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +46 -0
  38. data/lib/selenium/webdriver/common/element.rb +262 -0
  39. data/lib/selenium/webdriver/common/error.rb +212 -0
  40. data/lib/selenium/webdriver/common/file_reaper.rb +47 -0
  41. data/lib/selenium/webdriver/common/keyboard.rb +52 -0
  42. data/lib/selenium/webdriver/common/keys.rb +109 -0
  43. data/lib/selenium/webdriver/common/mouse.rb +65 -0
  44. data/lib/selenium/webdriver/common/navigation.rb +43 -0
  45. data/lib/selenium/webdriver/common/options.rb +128 -0
  46. data/lib/selenium/webdriver/common/platform.rb +166 -0
  47. data/lib/selenium/webdriver/common/port_prober.rb +25 -0
  48. data/lib/selenium/webdriver/common/profile_helper.rb +67 -0
  49. data/lib/selenium/webdriver/common/proxy.rb +120 -0
  50. data/lib/selenium/webdriver/common/search_context.rb +92 -0
  51. data/lib/selenium/webdriver/common/socket_poller.rb +100 -0
  52. data/lib/selenium/webdriver/common/target_locator.rb +81 -0
  53. data/lib/selenium/webdriver/common/timeouts.rb +29 -0
  54. data/lib/selenium/webdriver/common/wait.rb +60 -0
  55. data/lib/selenium/webdriver/common/window.rb +96 -0
  56. data/lib/selenium/webdriver/common/zipper.rb +82 -0
  57. data/lib/selenium/webdriver/firefox.rb +37 -0
  58. data/lib/selenium/webdriver/firefox/binary.rb +161 -0
  59. data/lib/selenium/webdriver/firefox/bridge.rb +58 -0
  60. data/lib/selenium/webdriver/firefox/extension.rb +52 -0
  61. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  62. data/lib/selenium/webdriver/firefox/launcher.rb +104 -0
  63. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  64. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  65. data/lib/selenium/webdriver/firefox/profile.rb +315 -0
  66. data/lib/selenium/webdriver/firefox/profiles_ini.rb +62 -0
  67. data/lib/selenium/webdriver/firefox/socket_lock.rb +61 -0
  68. data/lib/selenium/webdriver/firefox/util.rb +29 -0
  69. data/lib/selenium/webdriver/ie.rb +19 -0
  70. data/lib/selenium/webdriver/ie/bridge.rb +60 -0
  71. data/lib/selenium/webdriver/ie/native/win32/IEDriver.dll +0 -0
  72. data/lib/selenium/webdriver/ie/native/x64/IEDriver.dll +0 -0
  73. data/lib/selenium/webdriver/ie/server.rb +64 -0
  74. data/lib/selenium/webdriver/iphone.rb +9 -0
  75. data/lib/selenium/webdriver/iphone/bridge.rb +50 -0
  76. data/lib/selenium/webdriver/opera.rb +24 -0
  77. data/lib/selenium/webdriver/opera/bridge.rb +113 -0
  78. data/lib/selenium/webdriver/opera/service.rb +49 -0
  79. data/lib/selenium/webdriver/remote.rb +21 -0
  80. data/lib/selenium/webdriver/remote/bridge.rb +473 -0
  81. data/lib/selenium/webdriver/remote/capabilities.rb +241 -0
  82. data/lib/selenium/webdriver/remote/commands.rb +181 -0
  83. data/lib/selenium/webdriver/remote/http/common.rb +74 -0
  84. data/lib/selenium/webdriver/remote/http/curb.rb +79 -0
  85. data/lib/selenium/webdriver/remote/http/default.rb +102 -0
  86. data/lib/selenium/webdriver/remote/http/persistent.rb +38 -0
  87. data/lib/selenium/webdriver/remote/response.rb +99 -0
  88. data/lib/selenium/webdriver/remote/server_error.rb +17 -0
  89. data/lib/selenium/webdriver/support.rb +4 -0
  90. data/lib/selenium/webdriver/support/abstract_event_listener.rb +28 -0
  91. data/lib/selenium/webdriver/support/block_event_listener.rb +17 -0
  92. data/lib/selenium/webdriver/support/event_firing_bridge.rb +112 -0
  93. data/lib/selenium/webdriver/support/select.rb +293 -0
  94. data/spec/integration/selenium/client/api/backward_compatible_api_spec.rb +22 -0
  95. data/spec/integration/selenium/client/api/browser_xpath_library_spec.rb +17 -0
  96. data/spec/integration/selenium/client/api/click_spec.rb +39 -0
  97. data/spec/integration/selenium/client/api/cookie_spec.rb +39 -0
  98. data/spec/integration/selenium/client/api/element_spec.rb +14 -0
  99. data/spec/integration/selenium/client/api/highlight_located_element_spec.rb +19 -0
  100. data/spec/integration/selenium/client/api/retrieve_last_remote_control_logs_spec.rb +33 -0
  101. data/spec/integration/selenium/client/api/screenshot_spec.rb +29 -0
  102. data/spec/integration/selenium/client/api/select_window_spec.rb +46 -0
  103. data/spec/integration/selenium/client/api/start_stop_spec.rb +9 -0
  104. data/spec/integration/selenium/client/api/wait_for_ajax_spec.rb +27 -0
  105. data/spec/integration/selenium/client/api/wait_for_element_spec.rb +56 -0
  106. data/spec/integration/selenium/client/api/wait_for_field_value_spec.rb +52 -0
  107. data/spec/integration/selenium/client/api/wait_for_text_spec.rb +98 -0
  108. data/spec/integration/selenium/client/sample-app/public/jquery-1.3.2.js +4376 -0
  109. data/spec/integration/selenium/client/sample-app/public/jquery.html +55 -0
  110. data/spec/integration/selenium/client/sample-app/public/prototype-1.6.0.3.js +4320 -0
  111. data/spec/integration/selenium/client/sample-app/public/prototype.html +59 -0
  112. data/spec/integration/selenium/client/sample-app/sample_app.rb +32 -0
  113. data/spec/integration/selenium/client/spec_helper.rb +125 -0
  114. data/spec/integration/selenium/webdriver/chrome/driver_spec.rb +28 -0
  115. data/spec/integration/selenium/webdriver/chrome/profile_spec.rb +42 -0
  116. data/spec/integration/selenium/webdriver/driver_spec.rb +253 -0
  117. data/spec/integration/selenium/webdriver/element_spec.rb +185 -0
  118. data/spec/integration/selenium/webdriver/error_spec.rb +30 -0
  119. data/spec/integration/selenium/webdriver/firefox/driver_spec.rb +21 -0
  120. data/spec/integration/selenium/webdriver/firefox/profile_spec.rb +141 -0
  121. data/spec/integration/selenium/webdriver/keyboard_spec.rb +57 -0
  122. data/spec/integration/selenium/webdriver/mouse_spec.rb +55 -0
  123. data/spec/integration/selenium/webdriver/navigation_spec.rb +44 -0
  124. data/spec/integration/selenium/webdriver/opera/driver_spec.rb +47 -0
  125. data/spec/integration/selenium/webdriver/options_spec.rb +49 -0
  126. data/spec/integration/selenium/webdriver/remote/element_spec.rb +24 -0
  127. data/spec/integration/selenium/webdriver/spec_helper.rb +44 -0
  128. data/spec/integration/selenium/webdriver/spec_support.rb +13 -0
  129. data/spec/integration/selenium/webdriver/spec_support/guards.rb +86 -0
  130. data/spec/integration/selenium/webdriver/spec_support/helpers.rb +46 -0
  131. data/spec/integration/selenium/webdriver/spec_support/jruby_test_environment.rb +29 -0
  132. data/spec/integration/selenium/webdriver/spec_support/rack_server.rb +123 -0
  133. data/spec/integration/selenium/webdriver/spec_support/test_environment.rb +199 -0
  134. data/spec/integration/selenium/webdriver/target_locator_spec.rb +170 -0
  135. data/spec/integration/selenium/webdriver/timeout_spec.rb +56 -0
  136. data/spec/integration/selenium/webdriver/window_spec.rb +56 -0
  137. data/spec/integration/selenium/webdriver/zipper_spec.rb +66 -0
  138. data/spec/unit/selenium/client/base_spec.rb +239 -0
  139. data/spec/unit/selenium/client/extensions_spec.rb +174 -0
  140. data/spec/unit/selenium/client/idiomatic_spec.rb +500 -0
  141. data/spec/unit/selenium/client/javascript_expression_builder_spec.rb +79 -0
  142. data/spec/unit/selenium/client/javascript_frameworks/jquery_spec.rb +10 -0
  143. data/spec/unit/selenium/client/javascript_frameworks/prototype_spec.rb +10 -0
  144. data/spec/unit/selenium/client/protocol_spec.rb +124 -0
  145. data/spec/unit/selenium/client/selenium_helper_spec.rb +56 -0
  146. data/spec/unit/selenium/client/spec_helper.rb +24 -0
  147. data/spec/unit/selenium/rake/task_spec.rb +79 -0
  148. data/spec/unit/selenium/server_spec.rb +131 -0
  149. data/spec/unit/selenium/webdriver/action_builder_spec.rb +90 -0
  150. data/spec/unit/selenium/webdriver/android/bridge_spec.rb +31 -0
  151. data/spec/unit/selenium/webdriver/chrome/bridge_spec.rb +94 -0
  152. data/spec/unit/selenium/webdriver/chrome/profile_spec.rb +57 -0
  153. data/spec/unit/selenium/webdriver/chrome/service_spec.rb +44 -0
  154. data/spec/unit/selenium/webdriver/error_spec.rb +41 -0
  155. data/spec/unit/selenium/webdriver/firefox/bridge_spec.rb +17 -0
  156. data/spec/unit/selenium/webdriver/iphone/bridge_spec.rb +30 -0
  157. data/spec/unit/selenium/webdriver/proxy_spec.rb +87 -0
  158. data/spec/unit/selenium/webdriver/remote/bridge_spec.rb +16 -0
  159. data/spec/unit/selenium/webdriver/remote/capabilities_spec.rb +111 -0
  160. data/spec/unit/selenium/webdriver/remote/http/common_spec.rb +24 -0
  161. data/spec/unit/selenium/webdriver/remote/http/default_spec.rb +46 -0
  162. data/spec/unit/selenium/webdriver/search_context_spec.rb +61 -0
  163. data/spec/unit/selenium/webdriver/socket_poller_spec.rb +68 -0
  164. data/spec/unit/selenium/webdriver/spec_helper.rb +6 -0
  165. data/spec/unit/selenium/webdriver/support/event_firing_spec.rb +111 -0
  166. data/spec/unit/selenium/webdriver/support/select_spec.rb +290 -0
  167. data/spec/unit/selenium/webdriver/wait_spec.rb +40 -0
  168. metadata +215 -0
@@ -0,0 +1,290 @@
1
+ require File.expand_path("../../spec_helper", __FILE__)
2
+
3
+ module Selenium
4
+ module WebDriver
5
+ module Support
6
+
7
+ describe Select do
8
+ let(:select) {
9
+ mock(Element, :tag_name => 'select')
10
+ }
11
+
12
+ let(:multi_select) {
13
+ s = mock(Element, :tag_name => 'select')
14
+ s.stub(:attribute).with(:multiple).and_return "multiple"
15
+
16
+ s
17
+ }
18
+
19
+ it 'raises ArgumentError if passed a non-select Element' do
20
+ link = mock(Element, :tag_name => "a")
21
+
22
+ lambda {
23
+ Select.new link
24
+ }.should raise_error(ArgumentError)
25
+ end
26
+
27
+ it 'indicates whether a select is multiple correctly' do
28
+ selects = [
29
+ mock(Element, :tag_name => "select"),
30
+ mock(Element, :tag_name => "select"),
31
+ mock(Element, :tag_name => "select"),
32
+ mock(Element, :tag_name => "select")
33
+ ]
34
+
35
+ selects[0].stub(:attribute).with(:multiple).and_return("false")
36
+ selects[1].stub(:attribute).with(:multiple).and_return(nil)
37
+ selects[2].stub(:attribute).with(:multiple).and_return("true")
38
+ selects[3].stub(:attribute).with(:multiple).and_return("multiple")
39
+
40
+ Select.new(selects[0]).should_not be_multiple
41
+ Select.new(selects[1]).should_not be_multiple
42
+ Select.new(selects[2]).should be_multiple
43
+ Select.new(selects[3]).should be_multiple
44
+ end
45
+
46
+ it 'returns all options' do
47
+ options = []
48
+
49
+ multi_select.should_receive(:find_elements).
50
+ with(:tag_name, 'option').
51
+ once.
52
+ and_return(options)
53
+
54
+ Select.new(multi_select).options.should eql(options)
55
+ end
56
+
57
+ it 'returns all selected options' do
58
+ bad_option = mock(Element, :selected? => false)
59
+ good_option = mock(Element, :selected? => true)
60
+
61
+ multi_select.should_receive(:find_elements).
62
+ with(:tag_name, 'option').
63
+ once.
64
+ and_return([bad_option, good_option])
65
+
66
+ opts = Select.new(multi_select).selected_options
67
+
68
+ opts.size.should == 1
69
+ opts.first.should == good_option
70
+ end
71
+
72
+ it 'returns the first selected option' do
73
+ first_option = mock(Element, :selected? => true)
74
+ second_option = mock(Element, :selected? => true)
75
+
76
+ multi_select.should_receive(:find_elements).
77
+ with(:tag_name, 'option').
78
+ once.
79
+ and_return([first_option, second_option])
80
+
81
+ option = Select.new(multi_select).first_selected_option
82
+ option.should == first_option
83
+ end
84
+
85
+ it 'raises a NoSuchElementError if nothing is selected' do
86
+ option = mock(Element, :selected? => false)
87
+
88
+ multi_select.should_receive(:find_elements).
89
+ with(:tag_name, 'option').
90
+ once.
91
+ and_return([option])
92
+
93
+ lambda {
94
+ Select.new(multi_select).first_selected_option
95
+ }.should raise_error(Error::NoSuchElementError)
96
+ end
97
+
98
+ it 'allows options to be selected by visible text' do
99
+ option = mock(Element, :selected? => false)
100
+
101
+ multi_select.should_receive(:find_elements).
102
+ with(:xpath, './/option[normalize-space(.) = "fish"]').
103
+ once.
104
+ and_return([option])
105
+
106
+ option.should_receive(:click).once
107
+
108
+ Select.new(multi_select).select_by(:text, 'fish')
109
+ end
110
+
111
+ it 'allows options to be selected by index' do
112
+ first_option = mock(Element, :selected? => true)
113
+ second_option = mock(Element, :selected? => false)
114
+
115
+ first_option.should_receive(:attribute).with(:index).and_return "0"
116
+ first_option.should_receive(:click).never
117
+
118
+ second_option.should_receive(:attribute).with(:index).and_return '1'
119
+ second_option.should_receive(:click).once
120
+
121
+ multi_select.should_receive(:find_elements).
122
+ with(:tag_name, 'option').
123
+ and_return([first_option, second_option])
124
+
125
+ Select.new(multi_select).select_by(:index, 1)
126
+ end
127
+
128
+ it 'allows options to be selected by returned value' do
129
+ first_option = mock(Element, :selected? => false)
130
+ multi_select.should_receive(:find_elements).
131
+ with(:xpath, './/option[@value = "b"]').
132
+ and_return([first_option])
133
+
134
+ first_option.should_receive(:click).once
135
+
136
+ Select.new(multi_select).select_by(:value, 'b')
137
+ end
138
+
139
+ it 'can deselect all when select supports multiple selections' do
140
+ first_option = mock(Element, :selected? => true)
141
+ second_option = mock(Element, :selected? => false)
142
+
143
+ multi_select.should_receive(:find_elements).
144
+ with(:tag_name, 'option').
145
+ once.
146
+ and_return([first_option, second_option])
147
+
148
+ first_option.should_receive(:click).once
149
+ second_option.should_receive(:click).never
150
+
151
+ Select.new(multi_select).deselect_all
152
+ end
153
+
154
+ it 'can not deselect all when select does not support multiple selections' do
155
+ select.should_receive(:attribute).with(:multiple).and_return nil
156
+
157
+ lambda {
158
+ Select.new(select).deselect_all
159
+ }.should raise_error(Error::UnsupportedOperationError)
160
+ end
161
+
162
+ it 'can deselect options by visible text' do
163
+ first_option = mock(Element, :selected? => true)
164
+ second_option = mock(Element, :selected? => false)
165
+
166
+ multi_select.should_receive(:find_elements).
167
+ with(:xpath, './/option[normalize-space(.) = "b"]').
168
+ and_return([first_option, second_option])
169
+
170
+ first_option.should_receive(:click).once
171
+ second_option.should_receive(:click).never
172
+
173
+ Select.new(multi_select).deselect_by(:text, 'b')
174
+ end
175
+
176
+ it 'can deselect options by index' do
177
+ first_option = mock(Element, :selected? => true)
178
+ second_option = mock(Element)
179
+
180
+ multi_select.should_receive(:find_elements).
181
+ with(:tag_name, 'option').
182
+ and_return([first_option, second_option])
183
+
184
+ first_option.should_receive(:attribute).with(:index).and_return("2")
185
+ second_option.should_receive(:attribute).with(:index).and_return("1")
186
+
187
+ first_option.should_receive(:click).once
188
+ second_option.should_receive(:click).never
189
+
190
+ Select.new(multi_select).deselect_by(:index, 2)
191
+ end
192
+
193
+ it 'can deselect options by returned value' do
194
+ first_option = mock(Element, :selected? => true)
195
+ second_option = mock(Element, :selected? => false)
196
+
197
+ multi_select.should_receive(:find_elements).
198
+ with(:xpath, './/option[@value = "b"]').
199
+ and_return([first_option, second_option])
200
+
201
+ first_option.should_receive(:click).once
202
+ second_option.should_receive(:click).never
203
+
204
+ Select.new(multi_select).deselect_by(:value, 'b')
205
+ end
206
+
207
+ it 'should fall back to slow lookups when "get by visible text fails" and there is a space' do
208
+ first_option = mock(Element, :selected? => false, :text => 'foo bar')
209
+ first_option.stub(:to_a => [first_option])
210
+
211
+ xpath1 = './/option[normalize-space(.) = "foo bar"]'
212
+ xpath2 = './/option[contains(., "foo")]'
213
+
214
+ select.should_receive(:attribute).with(:multiple).and_return 'false'
215
+ select.should_receive(:find_elements).with(:xpath, xpath1).once.and_return([])
216
+ select.should_receive(:find_elements).with(:xpath, xpath2).once.and_return([first_option])
217
+
218
+ first_option.should_receive(:click).once
219
+
220
+ Select.new(select).select_by(:text, 'foo bar')
221
+ end
222
+
223
+ it 'should raise NoSuchElementError if there are no selects to select' do
224
+ select.should_receive(:attribute).with(:multiple).and_return('false')
225
+ select.should_receive(:find_elements).at_least(3).times.and_return []
226
+
227
+ s = Select.new select
228
+
229
+ lambda {
230
+ s.select_by :index, 12
231
+ }.should raise_error(Error::NoSuchElementError)
232
+
233
+ lambda {
234
+ s.select_by :value, 'not there'
235
+ }.should raise_error(Error::NoSuchElementError)
236
+
237
+ lambda {
238
+ s.select_by :text, 'also not there'
239
+ }.should raise_error(Error::NoSuchElementError)
240
+ end
241
+
242
+ it 'should raise NoSuchElementError if there are no selects to deselect' do
243
+ select.should_receive(:attribute).with(:multiple).and_return('false')
244
+ select.should_receive(:find_elements).at_least(3).times.and_return []
245
+
246
+ s = Select.new select
247
+
248
+ lambda {
249
+ s.deselect_by :index, 12
250
+ }.should raise_error(Error::NoSuchElementError)
251
+
252
+ lambda {
253
+ s.deselect_by :value, 'not there'
254
+ }.should raise_error(Error::NoSuchElementError)
255
+
256
+ lambda {
257
+ s.deselect_by :text, 'also not there'
258
+ }.should raise_error(Error::NoSuchElementError)
259
+ end
260
+ end # Select
261
+
262
+ describe Select::Escaper do
263
+ it 'converts an unquoted string into one with quotes' do
264
+ Select::Escaper.escape('abc').should == '"abc"'
265
+ Select::Escaper.escape('abc aqewqqw').should == '"abc aqewqqw"'
266
+ Select::Escaper.escape('').should == '""'
267
+ Select::Escaper.escape(' ').should == '" "'
268
+ Select::Escaper.escape(' abc ').should == '" abc "'
269
+ end
270
+
271
+ it 'double quotes a string that contains a single quote' do
272
+ Select::Escaper.escape("f'oo").should == %{"f'oo"}
273
+ end
274
+
275
+ it 'single quotes a string that contains a double quote' do
276
+ Select::Escaper.escape('f"oo').should == %{'f"oo'}
277
+ end
278
+
279
+ it 'provides concatenated strings when string to escape contains both single and double quotes' do
280
+ Select::Escaper.escape(%{f"o'o}).should == %{concat("f", '"', "o'o")}
281
+ end
282
+
283
+ it 'provides concatenated strings when string ends with quote' do
284
+ Select::Escaper.escape(%{'"}).should == %{concat("'", '"')}
285
+ end
286
+ end # Select::Escaper
287
+
288
+ end # Support
289
+ end # WebDriver
290
+ end # Selenium
@@ -0,0 +1,40 @@
1
+ require File.expand_path("../spec_helper", __FILE__)
2
+
3
+ describe "Wait" do
4
+ def wait(*args) Selenium::WebDriver::Wait.new(*args) end
5
+
6
+ it 'should wait until the returned value is true' do
7
+ returned = true
8
+ wait.until { returned = !returned }.should be_true
9
+ end
10
+
11
+ it 'should raise a TimeOutError if the the timer runs out' do
12
+ lambda {
13
+ wait(:timeout => 0.1).until { false }
14
+ }.should raise_error(Selenium::WebDriver::Error::TimeOutError)
15
+ end
16
+
17
+ it "should silently capture NoSuchElementErrors" do
18
+ called = false
19
+ block = lambda {
20
+ if called
21
+ true
22
+ else
23
+ called = true
24
+ raise Selenium::WebDriver::Error::NoSuchElementError
25
+ end
26
+ }
27
+
28
+ wait.until(&block).should be_true
29
+ end
30
+
31
+ it "will use the message from any NoSuchElementError raised while waiting" do
32
+ block = lambda { raise Selenium::WebDriver::Error::NoSuchElementError, "foo" }
33
+
34
+ lambda {
35
+ wait(:timeout => 0.5).until(&block)
36
+ }.should raise_error(Selenium::WebDriver::Error::TimeOutError, /foo/)
37
+ end
38
+
39
+
40
+ end
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bbc-selenium-webdriver
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.17.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Matthew Crouch
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-18 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Modified selenium driver to support rotation on iPhone
15
+ email: matthew.crouch@bbc.co.uk
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/selenium/client/base.rb
21
+ - lib/selenium/client/driver.rb
22
+ - lib/selenium/client/errors.rb
23
+ - lib/selenium/client/extensions.rb
24
+ - lib/selenium/client/idiomatic.rb
25
+ - lib/selenium/client/javascript_expression_builder.rb
26
+ - lib/selenium/client/javascript_frameworks/jquery.rb
27
+ - lib/selenium/client/javascript_frameworks/prototype.rb
28
+ - lib/selenium/client/legacy_driver.rb
29
+ - lib/selenium/client/protocol.rb
30
+ - lib/selenium/client/selenium_helper.rb
31
+ - lib/selenium/client.rb
32
+ - lib/selenium/rake/server_task.rb
33
+ - lib/selenium/server.rb
34
+ - lib/selenium/webdriver/android/bridge.rb
35
+ - lib/selenium/webdriver/android.rb
36
+ - lib/selenium/webdriver/chrome/bridge.rb
37
+ - lib/selenium/webdriver/chrome/profile.rb
38
+ - lib/selenium/webdriver/chrome/service.rb
39
+ - lib/selenium/webdriver/chrome.rb
40
+ - lib/selenium/webdriver/common/action_builder.rb
41
+ - lib/selenium/webdriver/common/alert.rb
42
+ - lib/selenium/webdriver/common/bridge_helper.rb
43
+ - lib/selenium/webdriver/common/core_ext/base64.rb
44
+ - lib/selenium/webdriver/common/core_ext/dir.rb
45
+ - lib/selenium/webdriver/common/core_ext/string.rb
46
+ - lib/selenium/webdriver/common/driver.rb
47
+ - lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb
48
+ - lib/selenium/webdriver/common/driver_extensions/rotatable.rb
49
+ - lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb
50
+ - lib/selenium/webdriver/common/driver_extensions/uploads_files.rb
51
+ - lib/selenium/webdriver/common/element.rb
52
+ - lib/selenium/webdriver/common/error.rb
53
+ - lib/selenium/webdriver/common/file_reaper.rb
54
+ - lib/selenium/webdriver/common/keyboard.rb
55
+ - lib/selenium/webdriver/common/keys.rb
56
+ - lib/selenium/webdriver/common/mouse.rb
57
+ - lib/selenium/webdriver/common/navigation.rb
58
+ - lib/selenium/webdriver/common/options.rb
59
+ - lib/selenium/webdriver/common/platform.rb
60
+ - lib/selenium/webdriver/common/port_prober.rb
61
+ - lib/selenium/webdriver/common/profile_helper.rb
62
+ - lib/selenium/webdriver/common/proxy.rb
63
+ - lib/selenium/webdriver/common/search_context.rb
64
+ - lib/selenium/webdriver/common/socket_poller.rb
65
+ - lib/selenium/webdriver/common/target_locator.rb
66
+ - lib/selenium/webdriver/common/timeouts.rb
67
+ - lib/selenium/webdriver/common/wait.rb
68
+ - lib/selenium/webdriver/common/window.rb
69
+ - lib/selenium/webdriver/common/zipper.rb
70
+ - lib/selenium/webdriver/common.rb
71
+ - lib/selenium/webdriver/firefox/binary.rb
72
+ - lib/selenium/webdriver/firefox/bridge.rb
73
+ - lib/selenium/webdriver/firefox/extension/webdriver.xpi
74
+ - lib/selenium/webdriver/firefox/extension.rb
75
+ - lib/selenium/webdriver/firefox/launcher.rb
76
+ - lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so
77
+ - lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so
78
+ - lib/selenium/webdriver/firefox/profile.rb
79
+ - lib/selenium/webdriver/firefox/profiles_ini.rb
80
+ - lib/selenium/webdriver/firefox/socket_lock.rb
81
+ - lib/selenium/webdriver/firefox/util.rb
82
+ - lib/selenium/webdriver/firefox.rb
83
+ - lib/selenium/webdriver/ie/bridge.rb
84
+ - lib/selenium/webdriver/ie/native/win32/IEDriver.dll
85
+ - lib/selenium/webdriver/ie/native/x64/IEDriver.dll
86
+ - lib/selenium/webdriver/ie/server.rb
87
+ - lib/selenium/webdriver/ie.rb
88
+ - lib/selenium/webdriver/iphone/bridge.rb
89
+ - lib/selenium/webdriver/iphone.rb
90
+ - lib/selenium/webdriver/opera/bridge.rb
91
+ - lib/selenium/webdriver/opera/service.rb
92
+ - lib/selenium/webdriver/opera.rb
93
+ - lib/selenium/webdriver/remote/bridge.rb
94
+ - lib/selenium/webdriver/remote/capabilities.rb
95
+ - lib/selenium/webdriver/remote/commands.rb
96
+ - lib/selenium/webdriver/remote/http/common.rb
97
+ - lib/selenium/webdriver/remote/http/curb.rb
98
+ - lib/selenium/webdriver/remote/http/default.rb
99
+ - lib/selenium/webdriver/remote/http/persistent.rb
100
+ - lib/selenium/webdriver/remote/response.rb
101
+ - lib/selenium/webdriver/remote/server_error.rb
102
+ - lib/selenium/webdriver/remote.rb
103
+ - lib/selenium/webdriver/support/abstract_event_listener.rb
104
+ - lib/selenium/webdriver/support/block_event_listener.rb
105
+ - lib/selenium/webdriver/support/event_firing_bridge.rb
106
+ - lib/selenium/webdriver/support/select.rb
107
+ - lib/selenium/webdriver/support.rb
108
+ - lib/selenium/webdriver.rb
109
+ - lib/selenium-client.rb
110
+ - lib/selenium-webdriver.rb
111
+ - spec/integration/selenium/client/api/backward_compatible_api_spec.rb
112
+ - spec/integration/selenium/client/api/browser_xpath_library_spec.rb
113
+ - spec/integration/selenium/client/api/click_spec.rb
114
+ - spec/integration/selenium/client/api/cookie_spec.rb
115
+ - spec/integration/selenium/client/api/element_spec.rb
116
+ - spec/integration/selenium/client/api/highlight_located_element_spec.rb
117
+ - spec/integration/selenium/client/api/retrieve_last_remote_control_logs_spec.rb
118
+ - spec/integration/selenium/client/api/screenshot_spec.rb
119
+ - spec/integration/selenium/client/api/select_window_spec.rb
120
+ - spec/integration/selenium/client/api/start_stop_spec.rb
121
+ - spec/integration/selenium/client/api/wait_for_ajax_spec.rb
122
+ - spec/integration/selenium/client/api/wait_for_element_spec.rb
123
+ - spec/integration/selenium/client/api/wait_for_field_value_spec.rb
124
+ - spec/integration/selenium/client/api/wait_for_text_spec.rb
125
+ - spec/integration/selenium/client/sample-app/public/jquery-1.3.2.js
126
+ - spec/integration/selenium/client/sample-app/public/jquery.html
127
+ - spec/integration/selenium/client/sample-app/public/prototype-1.6.0.3.js
128
+ - spec/integration/selenium/client/sample-app/public/prototype.html
129
+ - spec/integration/selenium/client/sample-app/sample_app.rb
130
+ - spec/integration/selenium/client/spec_helper.rb
131
+ - spec/integration/selenium/webdriver/chrome/driver_spec.rb
132
+ - spec/integration/selenium/webdriver/chrome/profile_spec.rb
133
+ - spec/integration/selenium/webdriver/driver_spec.rb
134
+ - spec/integration/selenium/webdriver/element_spec.rb
135
+ - spec/integration/selenium/webdriver/error_spec.rb
136
+ - spec/integration/selenium/webdriver/firefox/driver_spec.rb
137
+ - spec/integration/selenium/webdriver/firefox/profile_spec.rb
138
+ - spec/integration/selenium/webdriver/keyboard_spec.rb
139
+ - spec/integration/selenium/webdriver/mouse_spec.rb
140
+ - spec/integration/selenium/webdriver/navigation_spec.rb
141
+ - spec/integration/selenium/webdriver/opera/driver_spec.rb
142
+ - spec/integration/selenium/webdriver/options_spec.rb
143
+ - spec/integration/selenium/webdriver/remote/element_spec.rb
144
+ - spec/integration/selenium/webdriver/spec_helper.rb
145
+ - spec/integration/selenium/webdriver/spec_support/guards.rb
146
+ - spec/integration/selenium/webdriver/spec_support/helpers.rb
147
+ - spec/integration/selenium/webdriver/spec_support/jruby_test_environment.rb
148
+ - spec/integration/selenium/webdriver/spec_support/rack_server.rb
149
+ - spec/integration/selenium/webdriver/spec_support/test_environment.rb
150
+ - spec/integration/selenium/webdriver/spec_support.rb
151
+ - spec/integration/selenium/webdriver/target_locator_spec.rb
152
+ - spec/integration/selenium/webdriver/timeout_spec.rb
153
+ - spec/integration/selenium/webdriver/window_spec.rb
154
+ - spec/integration/selenium/webdriver/zipper_spec.rb
155
+ - spec/unit/selenium/client/base_spec.rb
156
+ - spec/unit/selenium/client/extensions_spec.rb
157
+ - spec/unit/selenium/client/idiomatic_spec.rb
158
+ - spec/unit/selenium/client/javascript_expression_builder_spec.rb
159
+ - spec/unit/selenium/client/javascript_frameworks/jquery_spec.rb
160
+ - spec/unit/selenium/client/javascript_frameworks/prototype_spec.rb
161
+ - spec/unit/selenium/client/protocol_spec.rb
162
+ - spec/unit/selenium/client/selenium_helper_spec.rb
163
+ - spec/unit/selenium/client/spec_helper.rb
164
+ - spec/unit/selenium/rake/task_spec.rb
165
+ - spec/unit/selenium/server_spec.rb
166
+ - spec/unit/selenium/webdriver/action_builder_spec.rb
167
+ - spec/unit/selenium/webdriver/android/bridge_spec.rb
168
+ - spec/unit/selenium/webdriver/chrome/bridge_spec.rb
169
+ - spec/unit/selenium/webdriver/chrome/profile_spec.rb
170
+ - spec/unit/selenium/webdriver/chrome/service_spec.rb
171
+ - spec/unit/selenium/webdriver/error_spec.rb
172
+ - spec/unit/selenium/webdriver/firefox/bridge_spec.rb
173
+ - spec/unit/selenium/webdriver/iphone/bridge_spec.rb
174
+ - spec/unit/selenium/webdriver/proxy_spec.rb
175
+ - spec/unit/selenium/webdriver/remote/bridge_spec.rb
176
+ - spec/unit/selenium/webdriver/remote/capabilities_spec.rb
177
+ - spec/unit/selenium/webdriver/remote/http/common_spec.rb
178
+ - spec/unit/selenium/webdriver/remote/http/default_spec.rb
179
+ - spec/unit/selenium/webdriver/search_context_spec.rb
180
+ - spec/unit/selenium/webdriver/socket_poller_spec.rb
181
+ - spec/unit/selenium/webdriver/spec_helper.rb
182
+ - spec/unit/selenium/webdriver/support/event_firing_spec.rb
183
+ - spec/unit/selenium/webdriver/support/select_spec.rb
184
+ - spec/unit/selenium/webdriver/wait_spec.rb
185
+ - README
186
+ - CHANGES
187
+ homepage: https://github.com/matt-crazypanda/selenium-webdriver
188
+ licenses: []
189
+ post_install_message:
190
+ rdoc_options:
191
+ - --charset=UTF-8
192
+ require_paths:
193
+ - lib
194
+ required_ruby_version: !ruby/object:Gem::Requirement
195
+ none: false
196
+ requirements:
197
+ - - ! '>='
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ segments:
201
+ - 0
202
+ hash: 3253400555983556140
203
+ required_rubygems_version: !ruby/object:Gem::Requirement
204
+ none: false
205
+ requirements:
206
+ - - ! '>='
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ requirements: []
210
+ rubyforge_project:
211
+ rubygems_version: 1.8.12
212
+ signing_key:
213
+ specification_version: 3
214
+ summary: Modified selenium driver to support rotation on iPhone
215
+ test_files: []