watir-proxy 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +16 -0
- data/lib/watir-proxy.rb +14 -5
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -34,6 +34,22 @@ A DRB server program and client libraries for Watir.
|
|
34
34
|
|
35
35
|
* sudo gem install watir-proxy
|
36
36
|
|
37
|
+
== EXAMPLES:
|
38
|
+
|
39
|
+
=== Create a profile
|
40
|
+
|
41
|
+
require 'rubygems'
|
42
|
+
require 'watir-proxy'
|
43
|
+
|
44
|
+
browser = WatirProxy::Server.browser(:type => :fx_with_profile, :driver => %{
|
45
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
46
|
+
profile.add_extension('/path/to/firebug.xpi'), :firebug)
|
47
|
+
profile.assume_untrusted_certificate_issuer = false
|
48
|
+
Selenium::WebDriver.for :firefox, :profile => profile
|
49
|
+
})
|
50
|
+
browser.goto 'http://localhost/'
|
51
|
+
|
52
|
+
|
37
53
|
== LICENSE:
|
38
54
|
|
39
55
|
Copyright (c) 2010 Taku AMANO
|
data/lib/watir-proxy.rb
CHANGED
@@ -5,7 +5,7 @@ require 'watir-webdriver'
|
|
5
5
|
require 'drb/drb'
|
6
6
|
|
7
7
|
module WatirProxy
|
8
|
-
VERSION = '0.0.
|
8
|
+
VERSION = '0.0.2'
|
9
9
|
|
10
10
|
class Browser
|
11
11
|
def initialize(opts = {})
|
@@ -29,10 +29,11 @@ module WatirProxy
|
|
29
29
|
@@default_browser = :firefox
|
30
30
|
@@default_drb_uri = 'druby://localhost:12444'
|
31
31
|
|
32
|
-
def self.browser(opts = {}
|
32
|
+
def self.browser(opts = {})
|
33
33
|
drb, browser = nil, nil
|
34
34
|
begin
|
35
35
|
drb = DRbObject.new_with_uri(self.drb_uri(opts))
|
36
|
+
drb.alive? if drb.respond_to?(:alive?)
|
36
37
|
rescue DRb::DRbConnError => e
|
37
38
|
browser = self.new(StringIO.new).browser(opts)
|
38
39
|
end
|
@@ -77,11 +78,19 @@ module WatirProxy
|
|
77
78
|
|
78
79
|
def browser(opts = {})
|
79
80
|
@current_browser = opts[:type] || @current_browser
|
80
|
-
@browsers[@current_browser] ||= new_browser(@current_browser)
|
81
|
+
@browsers[@current_browser] ||= new_browser(@current_browser, opts[:driver])
|
81
82
|
end
|
82
83
|
|
83
|
-
def new_browser(type)
|
84
|
-
|
84
|
+
def new_browser(type, driver)
|
85
|
+
driver = case driver
|
86
|
+
when String
|
87
|
+
eval driver
|
88
|
+
when nil
|
89
|
+
type
|
90
|
+
else
|
91
|
+
driver
|
92
|
+
end
|
93
|
+
Watir::Browser.new(driver)
|
85
94
|
end
|
86
95
|
|
87
96
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Taku AMANO
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-23 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|