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.
@@ -6,7 +6,7 @@ module Celerity
6
6
  attr_reader :webclient, :viewer
7
7
 
8
8
  #
9
- # Initialize a browser and goto the given URL
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
- # write me!
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
- # write me!
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. (Celerity only)
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, 'load_fancy_ajax_stuff').click
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 options on how to always use this.
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
- yield(self)
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
 
@@ -3,7 +3,7 @@ module Celerity #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
5
  TINY = 5
6
- PATCH = 8 # Set to nil for official release
6
+ PATCH = 9 # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
@@ -78,6 +78,8 @@ module Celerity
78
78
  alias_method :dragContentsTo, :drag_contents_to
79
79
  alias_method :getContents, :value
80
80
  alias_method :get_contents, :value
81
+
82
+ def requires_typing; end
81
83
  end
82
84
  end
83
85
 
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.8
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-02-24 00:00:00 -08:00
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.8.3
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