jarib-celerity 0.0.5.11 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +33 -0
- data/README.txt +1 -1
- data/lib/celerity/browser.rb +48 -5
- data/lib/celerity/element_locator.rb +1 -1
- data/lib/celerity/elements/option.rb +6 -0
- data/lib/celerity/htmlunit.rb +4 -1
- data/lib/celerity/htmlunit/htmlunit-2.5-SNAPSHOT.jar +0 -0
- data/lib/celerity/version.rb +2 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
+
== 0.0.6 2009-03-19
|
2
|
+
* Support for meta, strong, dl, dt, dd, and em HTML elements.
|
3
|
+
* Update to HtmlUnit 2.5-SNAPSHOT.
|
4
|
+
* New options for Browser#new: :proxy, :charset, :render, :log_level
|
5
|
+
* Methods added:
|
6
|
+
- Browser#add_cookie
|
7
|
+
- Browser#asynchronized
|
8
|
+
- Browser#add_listener
|
9
|
+
- Browser#content_type
|
10
|
+
- Browser#cookies
|
11
|
+
- Browser#debug_web_connection
|
12
|
+
- Browser#focused_element
|
13
|
+
- Browser#io
|
14
|
+
- Browser#remove_cookie
|
15
|
+
- Browser#response_headers
|
16
|
+
- Browser#wait
|
17
|
+
- Browser#xml
|
18
|
+
- Browser#{element,elements}_by_xpath
|
19
|
+
- ClickableElement#{double,right}_click
|
20
|
+
- ElementCollection#{first,last}
|
21
|
+
* Methods removed:
|
22
|
+
- Browser#show_*
|
23
|
+
* Methods renamed:
|
24
|
+
- SelectList#get_all_contents => SelectList#options
|
25
|
+
- SelectList#get_selected_items => selected_options
|
26
|
+
- SelectList#clear_selection => SelectList#clear
|
27
|
+
* Add support for finding elements by their corresponding <label>.
|
28
|
+
* Recognize buttons of type image, reset, submit.
|
29
|
+
* Proxy support (see Browser.new)
|
30
|
+
* Lots of refactorings, bug fixes and minor enhancements.
|
31
|
+
|
32
|
+
Thanks to Hirobumi Hama, Kamal Fariz Mahyuddin and Thomas Marek for contributions in this release.
|
33
|
+
|
1
34
|
== 0.0.4 2008-08-18
|
2
35
|
* Minor enhancements
|
3
36
|
* Update HtmlUnit to 2.2
|
data/README.txt
CHANGED
data/lib/celerity/browser.rb
CHANGED
@@ -231,7 +231,7 @@ module Celerity
|
|
231
231
|
# Get all the elements matching the given XPath.
|
232
232
|
#
|
233
233
|
# @param [String] xpath
|
234
|
-
# @
|
234
|
+
# @return [Array<Celerity::Element>] array of elements
|
235
235
|
#
|
236
236
|
|
237
237
|
def elements_by_xpath(xpath)
|
@@ -288,17 +288,60 @@ module Celerity
|
|
288
288
|
#
|
289
289
|
# Get the cookies for this session. (Celerity only)
|
290
290
|
#
|
291
|
+
# @return [Hash<domain, Hash<name, value>>]
|
292
|
+
#
|
291
293
|
|
292
294
|
def cookies
|
293
|
-
result = {}
|
295
|
+
result = Hash.new { |hash, key| hash[key] = {} }
|
294
296
|
|
295
|
-
cookies = @webclient.getCookieManager.getCookies
|
297
|
+
cookies = @webclient.getCookieManager.getCookies
|
296
298
|
cookies.each do |cookie|
|
297
|
-
result[cookie.getName] = cookie.getValue
|
299
|
+
result[cookie.getDomain][cookie.getName] = cookie.getValue
|
298
300
|
end
|
299
301
|
|
300
302
|
result
|
301
303
|
end
|
304
|
+
|
305
|
+
#
|
306
|
+
# Add a cookie with the given parameters (Celerity only)
|
307
|
+
#
|
308
|
+
# @param [String] domain
|
309
|
+
# @param [String] name
|
310
|
+
# @param [String] value
|
311
|
+
#
|
312
|
+
# @option opts :path [String] ("/") A path
|
313
|
+
# @option opts :max_age [Fixnum] (??) A max age
|
314
|
+
# @option opts :secure [Boolean] (false)
|
315
|
+
#
|
316
|
+
|
317
|
+
def add_cookie(domain, name, value, opts = {})
|
318
|
+
path = opts.delete(:path) || "/"
|
319
|
+
max_age = opts.delete(:max_age) || (Time.now + 60*60*24) # not sure if this is correct
|
320
|
+
secure = opts.delete(:secure) || false
|
321
|
+
|
322
|
+
raise "unknown option: #{opts.inspect}" unless opts.empty?
|
323
|
+
|
324
|
+
cookie = Cookie.new(domain, name, value, path, max_age, secure)
|
325
|
+
@webclient.getCookieManager.addCookie(cookie)
|
326
|
+
end
|
327
|
+
|
328
|
+
#
|
329
|
+
# Remove the cookie with the given domain and name (Celerity only)
|
330
|
+
#
|
331
|
+
# @param [String] domain
|
332
|
+
# @param [String] name
|
333
|
+
#
|
334
|
+
|
335
|
+
def remove_cookie(domain, name)
|
336
|
+
cm = @webclient.getCookieManager
|
337
|
+
cookie = cm.getCookies.find { |c| c.getDomain == domain && c.getName == name }
|
338
|
+
|
339
|
+
if cookie.nil?
|
340
|
+
raise "no cookie with domain #{domain.inspect} and name #{name.inspect}"
|
341
|
+
end
|
342
|
+
|
343
|
+
cm.removeCookie(cookie)
|
344
|
+
end
|
302
345
|
|
303
346
|
#
|
304
347
|
# Execute the given JavaScript on the current page.
|
@@ -310,7 +353,7 @@ module Celerity
|
|
310
353
|
@page.executeJavaScript(source.to_s).getJavaScriptResult
|
311
354
|
end
|
312
355
|
|
313
|
-
# experimental
|
356
|
+
# experimental - should be removed?
|
314
357
|
def send_keys(keys)
|
315
358
|
keys = keys.gsub(/\s*/, '').scan(/((?:\{[A-Z]+?\})|.)/u).flatten
|
316
359
|
keys.each do |key|
|
data/lib/celerity/htmlunit.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
module Celerity
|
2
2
|
Jars = Dir[File.dirname(__FILE__) + '/htmlunit/*.jar']
|
3
|
+
Jars.each { |jar| require(jar) }
|
4
|
+
|
5
|
+
include_class org.apache.commons.httpclient.Cookie
|
3
6
|
end
|
4
7
|
|
5
|
-
|
8
|
+
|
6
9
|
|
7
10
|
module HtmlUnit
|
8
11
|
include_package 'com.gargoylesoftware.htmlunit'
|
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.
|
4
|
+
version: 0.0.6
|
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-03-
|
14
|
+
date: 2009-03-19 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|