selenium-webdriver 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +10 -1
- data/lib/selenium/webdriver/chrome/bridge.rb +1 -1
- data/lib/selenium/webdriver/chrome/extension.zip +0 -0
- data/lib/selenium/webdriver/chrome/launcher.rb +37 -37
- data/lib/selenium/webdriver/common/proxy.rb +1 -4
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/ie/native/win32/InternetExplorerDriver.dll +0 -0
- data/lib/selenium/webdriver/ie/native/x64/InternetExplorerDriver.dll +0 -0
- data/lib/selenium/webdriver/remote/bridge.rb +9 -14
- data/lib/selenium/webdriver/remote/http/common.rb +13 -6
- data/lib/selenium/webdriver/remote/http/curb.rb +2 -2
- data/lib/selenium/webdriver/remote/http/default.rb +22 -8
- metadata +3 -3
data/CHANGES
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1 (2010-11-29)
|
2
|
+
==================
|
3
|
+
|
4
|
+
* Fix for Chrome.path=
|
5
|
+
* Remote drivers always add Content-Length for POST requests (thanks joshuachisholm)
|
6
|
+
* Fix for JS execution bug in the IE driver
|
7
|
+
* Add ability to specify a proxy on the Http::Default client.
|
8
|
+
* The remote drivers' :http_client argument now take a configured instance.
|
9
|
+
|
10
|
+
0.1.0 (2010-11-11)
|
2
11
|
===================
|
3
12
|
|
4
13
|
* selenium-client code (Se1/RC client) is now included in the gem (require "selenium/client").
|
Binary file
|
@@ -8,21 +8,6 @@ module Selenium
|
|
8
8
|
|
9
9
|
attr_reader :pid
|
10
10
|
|
11
|
-
def self.launcher(*args)
|
12
|
-
launcher = case Platform.os
|
13
|
-
when :windows
|
14
|
-
WindowsLauncher.new(*args)
|
15
|
-
when :macosx
|
16
|
-
MacOSXLauncher.new(*args)
|
17
|
-
when :unix, :linux
|
18
|
-
UnixLauncher.new(*args)
|
19
|
-
else
|
20
|
-
raise "unknown OS: #{Platform.os}"
|
21
|
-
end
|
22
|
-
|
23
|
-
launcher
|
24
|
-
end
|
25
|
-
|
26
11
|
def initialize(opts = {})
|
27
12
|
@default_profile = opts[:default_profile]
|
28
13
|
@secure_ssl = !!opts[:secure_ssl]
|
@@ -122,10 +107,39 @@ module Selenium
|
|
122
107
|
)
|
123
108
|
end
|
124
109
|
|
125
|
-
class
|
126
|
-
def
|
110
|
+
class << self
|
111
|
+
def possible_paths
|
112
|
+
case Platform.os
|
113
|
+
when :windows
|
114
|
+
windows_paths
|
115
|
+
when :macosx
|
116
|
+
macosx_paths
|
117
|
+
when :unix, :linux
|
118
|
+
unix_paths
|
119
|
+
else
|
120
|
+
raise "unknown OS: #{Platform.os}"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def unix_paths
|
125
|
+
[
|
126
|
+
Platform.find_binary("google-chrome"),
|
127
|
+
Platform.find_binary("chromium"),
|
128
|
+
Platform.find_binary("chromium-browser"),
|
129
|
+
"/usr/bin/google-chrome"
|
130
|
+
].compact
|
131
|
+
end
|
132
|
+
|
133
|
+
def macosx_paths
|
134
|
+
[
|
135
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
136
|
+
"#{Platform.home}/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
137
|
+
]
|
138
|
+
end
|
139
|
+
|
140
|
+
def windows_paths
|
127
141
|
[
|
128
|
-
|
142
|
+
windows_registry_path,
|
129
143
|
"#{ENV['USERPROFILE']}\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe",
|
130
144
|
"#{ENV['USERPROFILE']}\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
|
131
145
|
"#{Platform.home}\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe",
|
@@ -133,10 +147,12 @@ module Selenium
|
|
133
147
|
].compact
|
134
148
|
end
|
135
149
|
|
136
|
-
def
|
150
|
+
def windows_registry_path
|
137
151
|
require "win32/registry"
|
138
152
|
|
139
|
-
reg = Win32::Registry::HKEY_LOCAL_MACHINE.open(
|
153
|
+
reg = Win32::Registry::HKEY_LOCAL_MACHINE.open(
|
154
|
+
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe")
|
155
|
+
|
140
156
|
reg[""]
|
141
157
|
rescue LoadError
|
142
158
|
# older JRuby and IronRuby does not have win32/registry
|
@@ -144,23 +160,7 @@ module Selenium
|
|
144
160
|
rescue Win32::Registry::Error
|
145
161
|
nil
|
146
162
|
end
|
147
|
-
end
|
148
|
-
|
149
|
-
class UnixLauncher < Launcher
|
150
|
-
def self.possible_paths
|
151
|
-
[Platform.find_binary("google-chrome"), Platform.find_binary("chromium"), "/usr/bin/google-chrome"].compact
|
152
|
-
end
|
153
|
-
|
154
|
-
end
|
155
|
-
|
156
|
-
class MacOSXLauncher < UnixLauncher
|
157
|
-
def self.possible_paths
|
158
|
-
[
|
159
|
-
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
160
|
-
"#{Platform.home}/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
161
|
-
]
|
162
|
-
end
|
163
|
-
end
|
163
|
+
end # class << self
|
164
164
|
|
165
165
|
end # Launcher
|
166
166
|
end # Chrome
|
@@ -34,12 +34,10 @@ module Selenium
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def ==(other)
|
37
|
-
|
38
|
-
as_json == other.as_json
|
37
|
+
other.kind_of?(self.class) && as_json == other.as_json
|
39
38
|
end
|
40
39
|
alias_method :eql?, :==
|
41
40
|
|
42
|
-
|
43
41
|
def ftp=(value)
|
44
42
|
self.type = :manual
|
45
43
|
@ftp = value
|
@@ -111,7 +109,6 @@ module Selenium
|
|
111
109
|
|
112
110
|
proxy
|
113
111
|
end
|
114
|
-
|
115
112
|
end # class << self
|
116
113
|
|
117
114
|
end # Proxy
|
Binary file
|
Binary file
|
Binary file
|
@@ -37,15 +37,16 @@ module Selenium
|
|
37
37
|
# Initializes the bridge with the given server URL.
|
38
38
|
#
|
39
39
|
# @param url [String] url for the remote server
|
40
|
-
# @param http_client [
|
40
|
+
# @param http_client [Object] an HTTP client instance that implements the same protocol as Http::Default
|
41
41
|
# @param desired_capabilities [Capabilities] an instance of Remote::Capabilities describing the capabilities you want
|
42
42
|
#
|
43
43
|
|
44
44
|
def initialize(opts = {})
|
45
|
-
opts
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
opts = opts.dup
|
46
|
+
|
47
|
+
http_client = opts.delete(:http_client) { Http::Default.new }
|
48
|
+
desired_capabilities = opts.delete(:desired_capabilities) { Capabilities.firefox }
|
49
|
+
url = opts.delete(:url) { "http://localhost:4444/wd/hub" }
|
49
50
|
|
50
51
|
unless opts.empty?
|
51
52
|
raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
|
@@ -62,7 +63,9 @@ module Selenium
|
|
62
63
|
uri = URI.parse(url)
|
63
64
|
uri.path += "/" unless uri.path =~ /\/$/
|
64
65
|
|
65
|
-
|
66
|
+
http_client.server_url = uri
|
67
|
+
|
68
|
+
@http = http_client
|
66
69
|
@capabilities = create_session(desired_capabilities)
|
67
70
|
end
|
68
71
|
|
@@ -406,14 +409,6 @@ module Selenium
|
|
406
409
|
http.call verb, path, command_hash
|
407
410
|
end
|
408
411
|
|
409
|
-
def default_options
|
410
|
-
{
|
411
|
-
:url => "http://localhost:4444/wd/hub",
|
412
|
-
:http_client => Http::Default,
|
413
|
-
:desired_capabilities => Capabilities.firefox
|
414
|
-
}
|
415
|
-
end
|
416
|
-
|
417
412
|
end # Bridge
|
418
413
|
end # Remote
|
419
414
|
end # WebDriver
|
@@ -7,16 +7,17 @@ module Selenium
|
|
7
7
|
CONTENT_TYPE = "application/json"
|
8
8
|
DEFAULT_HEADERS = { "Accept" => CONTENT_TYPE }
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
# deprecated.
|
11
|
+
def self.timeout=(timeout)
|
12
|
+
raise Error::WebDriverError,
|
13
|
+
"Configuration of HTTP timeouts has changed. See http://code.google.com/p/selenium/wiki/RubyBindings for updated intructions."
|
12
14
|
end
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
16
|
+
attr_accessor :timeout
|
17
|
+
attr_writer :server_url
|
17
18
|
|
18
19
|
def call(verb, url, command_hash)
|
19
|
-
url =
|
20
|
+
url = server_url.merge(url) unless url.kind_of?(URI)
|
20
21
|
headers = DEFAULT_HEADERS.dup
|
21
22
|
|
22
23
|
if command_hash
|
@@ -28,6 +29,8 @@ module Selenium
|
|
28
29
|
puts " >>> #{payload}"
|
29
30
|
puts " > #{headers.inspect}"
|
30
31
|
end
|
32
|
+
elsif verb == :post
|
33
|
+
headers["Content-Length"] = "0"
|
31
34
|
end
|
32
35
|
|
33
36
|
request verb, url, headers, payload
|
@@ -35,6 +38,10 @@ module Selenium
|
|
35
38
|
|
36
39
|
private
|
37
40
|
|
41
|
+
def server_url
|
42
|
+
@server_url or raise Error::WebDriverError, "server_url not set"
|
43
|
+
end
|
44
|
+
|
38
45
|
def request(verb, url, headers, payload)
|
39
46
|
raise NotImplementedError, "subclass responsibility"
|
40
47
|
end
|
@@ -19,7 +19,7 @@ module Selenium
|
|
19
19
|
# require 'selenium/webdriver/remote/http/curb'
|
20
20
|
# include Selenium
|
21
21
|
#
|
22
|
-
# driver = WebDriver.for :firefox, :http_client => WebDriver::Remote::Http::Curb
|
22
|
+
# driver = WebDriver.for :firefox, :http_client => WebDriver::Remote::Http::Curb.new
|
23
23
|
#
|
24
24
|
|
25
25
|
class Curb < Common
|
@@ -65,7 +65,7 @@ module Selenium
|
|
65
65
|
|
66
66
|
c.max_redirects = MAX_REDIRECTS
|
67
67
|
c.follow_location = true
|
68
|
-
c.timeout =
|
68
|
+
c.timeout = @timeout if @timeout
|
69
69
|
c.verbose = !!$DEBUG
|
70
70
|
|
71
71
|
c
|
@@ -6,21 +6,21 @@ module Selenium
|
|
6
6
|
module Http
|
7
7
|
# @private
|
8
8
|
class Default < Common
|
9
|
+
attr_accessor :proxy
|
9
10
|
|
10
11
|
private
|
11
12
|
|
12
13
|
def http
|
13
|
-
# ignoring SSL for now
|
14
14
|
@http ||= (
|
15
|
-
http =
|
16
|
-
if
|
15
|
+
http = new_http_client
|
16
|
+
if server_url.scheme == "https"
|
17
17
|
http.use_ssl = true
|
18
18
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
19
19
|
end
|
20
20
|
|
21
|
-
if
|
22
|
-
http.open_timeout =
|
23
|
-
http.read_timeout =
|
21
|
+
if @timeout
|
22
|
+
http.open_timeout = @timeout
|
23
|
+
http.read_timeout = @timeout
|
24
24
|
end
|
25
25
|
|
26
26
|
http
|
@@ -54,13 +54,27 @@ module Selenium
|
|
54
54
|
def new_request_for(verb, url, headers)
|
55
55
|
req = Net::HTTP.const_get(verb.to_s.capitalize).new(url.path, headers)
|
56
56
|
|
57
|
-
if
|
58
|
-
req.basic_auth
|
57
|
+
if server_url.userinfo
|
58
|
+
req.basic_auth server_url.user, server_url.password
|
59
59
|
end
|
60
60
|
|
61
61
|
req
|
62
62
|
end
|
63
63
|
|
64
|
+
def new_http_client
|
65
|
+
if @proxy
|
66
|
+
unless @proxy.respond_to?(:http) && url = @proxy.http
|
67
|
+
raise Error::WebDriverError, "expected HTTP proxy, got #{@proxy.inspect}"
|
68
|
+
end
|
69
|
+
proxy = URI.parse(url)
|
70
|
+
|
71
|
+
clazz = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password)
|
72
|
+
clazz.new(server_url.host, server_url.port)
|
73
|
+
else
|
74
|
+
Net::HTTP.new server_url.host, server_url.port
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
64
78
|
end # Default
|
65
79
|
end # Http
|
66
80
|
end # Remote
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jari Bakken
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-30 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|