jarib-celerity 0.0.5.8 → 0.0.5.9
Sign up to get free protection for your applications and to get access to all the features.
data/lib/celerity/browser.rb
CHANGED
@@ -6,7 +6,7 @@ module Celerity
|
|
6
6
|
attr_reader :webclient, :viewer
|
7
7
|
|
8
8
|
#
|
9
|
-
# Initialize a browser and
|
9
|
+
# Initialize a browser and go to the given URL
|
10
10
|
#
|
11
11
|
# @param [String] uri The URL to go to.
|
12
12
|
# @return [Celerity::Browser] instance.
|
@@ -215,8 +215,12 @@ module Celerity
|
|
215
215
|
end
|
216
216
|
|
217
217
|
#
|
218
|
-
#
|
218
|
+
# Get the first element found matching the given XPath.
|
219
219
|
#
|
220
|
+
# @param [String] xpath
|
221
|
+
# @return [Celerity::Element] An element subclass (or Element if none is found)
|
222
|
+
#
|
223
|
+
|
220
224
|
def element_by_xpath(xpath)
|
221
225
|
assert_exists
|
222
226
|
obj = @page.getFirstByXPath(xpath)
|
@@ -224,8 +228,12 @@ module Celerity
|
|
224
228
|
end
|
225
229
|
|
226
230
|
#
|
227
|
-
#
|
231
|
+
# Get all the elements matching the given XPath.
|
228
232
|
#
|
233
|
+
# @param [String] xpath
|
234
|
+
# @retrun [Array<Celerity::Element>] array of elements
|
235
|
+
#
|
236
|
+
|
229
237
|
def elements_by_xpath(xpath)
|
230
238
|
assert_exists
|
231
239
|
objects = @page.getByXPath(xpath)
|
@@ -293,7 +301,7 @@ module Celerity
|
|
293
301
|
end
|
294
302
|
|
295
303
|
#
|
296
|
-
# Execute the given JavaScript on the current page.
|
304
|
+
# Execute the given JavaScript on the current page.
|
297
305
|
# @return [Object] The resulting Object
|
298
306
|
#
|
299
307
|
|
@@ -356,19 +364,32 @@ module Celerity
|
|
356
364
|
# Allows you to temporarily switch to HtmlUnit's NicelyResynchronizingAjaxController to resynchronize ajax calls.
|
357
365
|
#
|
358
366
|
# @browser.resynchronized do |b|
|
359
|
-
# b.link(:id, '
|
367
|
+
# b.link(:id, 'trigger_ajax_call').click
|
360
368
|
# end
|
361
369
|
#
|
362
370
|
# @yieldparam [Celerity::Browser] browser The current browser object.
|
363
|
-
# @see Celerity::Browser#new for
|
371
|
+
# @see Celerity::Browser#new for how to configure the browser to always use this.
|
364
372
|
#
|
365
373
|
|
366
374
|
def resynchronized(&block)
|
367
375
|
old_controller = @webclient.ajaxController
|
368
376
|
@webclient.setAjaxController(::HtmlUnit::NicelyResynchronizingAjaxController.new)
|
369
|
-
|
370
|
-
|
371
|
-
|
377
|
+
yield self
|
378
|
+
@webclient.setAjaxController(old_controller)
|
379
|
+
end
|
380
|
+
|
381
|
+
#
|
382
|
+
# Allows you to temporarliy switch to HtmlUnit's default AjaxController, so ajax calls are performed asynchronously.
|
383
|
+
# This is useful if you have created the Browser with :resynchronize => true, but want to switch it off temporarily.
|
384
|
+
#
|
385
|
+
# @yieldparam [Celerity::Browser] browser The current browser object.
|
386
|
+
# @see Celerity::Browser#new
|
387
|
+
#
|
388
|
+
|
389
|
+
def asynchronized(&block)
|
390
|
+
old_controller = @webclient.ajaxController
|
391
|
+
@webclient.setAjaxController(::HtmlUnit::AjaxController.new)
|
392
|
+
yield self
|
372
393
|
@webclient.setAjaxController(old_controller)
|
373
394
|
end
|
374
395
|
|
Binary file
|
data/lib/celerity/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jarib-celerity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.5.
|
4
|
+
version: 0.0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-
|
14
|
+
date: 2009-03-05 00:00:00 -08:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
requirements:
|
23
23
|
- - ">="
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 1.
|
25
|
+
version: 1.9.0
|
26
26
|
version:
|
27
27
|
description: "Celerity is a JRuby wrapper around HtmlUnit \xE2\x80\x93 a headless Java browser with JavaScript support. It provides a simple API for programmatic navigation through web applications. Celerity aims at being API compatible with Watir."
|
28
28
|
email: jari.bakken@finn.no
|