selenium-webdriver 0.0.19 → 0.0.20
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/chrome/src/rb/lib/selenium/webdriver/chrome/bridge.rb +1 -1
- data/chrome/src/rb/lib/selenium/webdriver/chrome/launcher.rb +2 -2
- data/common/src/rb/CHANGES +5 -0
- data/common/src/rb/lib/selenium/webdriver/child_process.rb +59 -2
- data/firefox/prebuilt/{linux64/Release/x_ignore_nofocus.so → amd64/libnoblur64.so} +0 -0
- data/firefox/prebuilt/{linux/Release/x_ignore_nofocus.so → i386/libnoblur.so} +0 -0
- data/firefox/src/rb/lib/selenium/webdriver/firefox.rb +1 -2
- data/firefox/src/rb/lib/selenium/webdriver/firefox/binary.rb +5 -1
- data/firefox/src/rb/lib/selenium/webdriver/firefox/bridge.rb +2 -2
- data/firefox/src/rb/lib/selenium/webdriver/firefox/launcher.rb +19 -21
- data/firefox/src/rb/lib/selenium/webdriver/firefox/profile.rb +9 -5
- metadata +5 -6
- data/firefox/src/rb/lib/selenium/webdriver/firefox/extension_connection.rb +0 -33
data/common/src/rb/CHANGES
CHANGED
@@ -23,11 +23,14 @@ module Selenium
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def ugly_death?
|
26
|
-
code = exit_value
|
27
|
-
# if exit_val is nil, the process is still alive
|
26
|
+
code = exit_value
|
28
27
|
code && code != 0
|
29
28
|
end
|
30
29
|
|
30
|
+
#
|
31
|
+
# Returns the exit value of the process, or nil if it's still alive.
|
32
|
+
#
|
33
|
+
|
31
34
|
def exit_value
|
32
35
|
pid, status = Process.waitpid2(@pid, Process::WNOHANG)
|
33
36
|
status.exitstatus if pid
|
@@ -45,6 +48,52 @@ module Selenium
|
|
45
48
|
self
|
46
49
|
end
|
47
50
|
|
51
|
+
#
|
52
|
+
# Tries increasingly harsher methods to make the process die within
|
53
|
+
# a reasonable time
|
54
|
+
#
|
55
|
+
|
56
|
+
def ensure_death
|
57
|
+
begin
|
58
|
+
$stderr.puts "wait_nonblock(5) -> #{self}" if $DEBUG
|
59
|
+
return wait_nonblock(5)
|
60
|
+
rescue Error::TimeOutError
|
61
|
+
# try next
|
62
|
+
end
|
63
|
+
|
64
|
+
$stderr.puts "TERM -> #{self}" if $DEBUG
|
65
|
+
kill
|
66
|
+
|
67
|
+
begin
|
68
|
+
$stderr.puts "wait_nonblock(5) -> #{self}" if $DEBUG
|
69
|
+
return wait_nonblock(5)
|
70
|
+
rescue Error::TimeOutError
|
71
|
+
# try next
|
72
|
+
end
|
73
|
+
|
74
|
+
$stderr.puts "KILL -> #{self}" if $DEBUG
|
75
|
+
kill!
|
76
|
+
|
77
|
+
$stderr.puts "wait_nonblock(5) -> #{self}" if $DEBUG
|
78
|
+
wait_nonblock(5)
|
79
|
+
rescue Errno::ECHILD
|
80
|
+
# great!
|
81
|
+
true
|
82
|
+
end
|
83
|
+
|
84
|
+
def wait_nonblock(timeout)
|
85
|
+
end_time = Time.now + timeout
|
86
|
+
until Time.now > end_time || exited = exit_value
|
87
|
+
sleep 0.1
|
88
|
+
end
|
89
|
+
|
90
|
+
unless exited
|
91
|
+
raise Error::TimeOutError, "process still alive after #{timeout} seconds"
|
92
|
+
end
|
93
|
+
|
94
|
+
exited
|
95
|
+
end
|
96
|
+
|
48
97
|
def wait
|
49
98
|
assert_started
|
50
99
|
Process.waitpid2 @pid
|
@@ -76,6 +125,13 @@ module Selenium
|
|
76
125
|
|
77
126
|
self
|
78
127
|
end
|
128
|
+
|
129
|
+
def wait_nonblock(timeout)
|
130
|
+
return super if defined?(Process::WNOHANG)
|
131
|
+
Timeout.timeout(timeout, Error::TimeOutError) { wait }
|
132
|
+
rescue Process::Error
|
133
|
+
# no handle, great
|
134
|
+
end
|
79
135
|
|
80
136
|
def kill
|
81
137
|
kill!
|
@@ -84,6 +140,7 @@ module Selenium
|
|
84
140
|
|
85
141
|
module JRubyProcess
|
86
142
|
def start
|
143
|
+
require 'java'
|
87
144
|
pb = java.lang.ProcessBuilder.new(@args)
|
88
145
|
|
89
146
|
env = pb.environment
|
File without changes
|
File without changes
|
@@ -5,7 +5,6 @@ require "selenium/webdriver/firefox/util"
|
|
5
5
|
require "selenium/webdriver/firefox/binary"
|
6
6
|
require "selenium/webdriver/firefox/profiles_ini"
|
7
7
|
require "selenium/webdriver/firefox/profile"
|
8
|
-
require "selenium/webdriver/firefox/extension_connection"
|
9
8
|
require "selenium/webdriver/firefox/launcher"
|
10
9
|
require "selenium/webdriver/firefox/bridge"
|
11
10
|
|
@@ -17,7 +16,7 @@ module Selenium
|
|
17
16
|
|
18
17
|
DEFAULT_PROFILE_NAME = "WebDriver".freeze
|
19
18
|
DEFAULT_PORT = 7055
|
20
|
-
DEFAULT_ENABLE_NATIVE_EVENTS =
|
19
|
+
DEFAULT_ENABLE_NATIVE_EVENTS = Platform.os == :windows
|
21
20
|
DEFAULT_SECURE_SSL = false
|
22
21
|
DEFAULT_ASSUME_UNTRUSTED_ISSUER = true
|
23
22
|
DEFAULT_LOAD_NO_FOCUS_LIB = Platform.os == :linux
|
@@ -49,6 +49,10 @@ module Selenium
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
def quit
|
53
|
+
@process.ensure_death if @process
|
54
|
+
end
|
55
|
+
|
52
56
|
def kill
|
53
57
|
@process.kill if @process
|
54
58
|
end
|
@@ -95,7 +99,7 @@ module Selenium
|
|
95
99
|
lm = Win32::Registry::HKEY_LOCAL_MACHINE
|
96
100
|
lm.open("SOFTWARE\\Mozilla\\Mozilla Firefox") do |reg|
|
97
101
|
main = lm.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{reg.keys[0]}\\Main")
|
98
|
-
if entry = main.find {|key, type, data| key =~ /pathtoexe/i}
|
102
|
+
if entry = main.find { |key, type, data| key =~ /pathtoexe/i }
|
99
103
|
return entry.last
|
100
104
|
end
|
101
105
|
end
|
@@ -18,7 +18,7 @@ module Selenium
|
|
18
18
|
end
|
19
19
|
|
20
20
|
@launcher.launch
|
21
|
-
super :url => @launcher.
|
21
|
+
super :url => @launcher.url, :desired_capabilities => :firefox
|
22
22
|
end
|
23
23
|
|
24
24
|
def browser
|
@@ -31,7 +31,7 @@ module Selenium
|
|
31
31
|
|
32
32
|
def quit
|
33
33
|
super
|
34
|
-
@binary.
|
34
|
+
@binary.quit
|
35
35
|
|
36
36
|
nil
|
37
37
|
end
|
@@ -7,8 +7,8 @@ module Selenium
|
|
7
7
|
# @private
|
8
8
|
class Launcher
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
SOCKET_LOCK_TIMEOUT = 45
|
11
|
+
STABLE_CONNECTION_TIMEOUT = 60
|
12
12
|
|
13
13
|
def initialize(binary, port = DEFAULT_PORT, profile = DEFAULT_PROFILE_NAME)
|
14
14
|
@binary = binary
|
@@ -30,6 +30,10 @@ module Selenium
|
|
30
30
|
@host = "127.0.0.1"
|
31
31
|
end
|
32
32
|
|
33
|
+
def url
|
34
|
+
"http://#{@host}:#{@port}/hub"
|
35
|
+
end
|
36
|
+
|
33
37
|
def launch
|
34
38
|
with_lock do
|
35
39
|
find_free_port
|
@@ -59,8 +63,7 @@ module Selenium
|
|
59
63
|
end
|
60
64
|
end
|
61
65
|
|
62
|
-
raise Error::WebDriverError,
|
63
|
-
"Unable to bind to locking port #{locking_port} within #{SOCKET_LOCK_TIMEOUT} seconds"
|
66
|
+
raise Error::WebDriverError, "unable to bind to locking port #{locking_port} within #{SOCKET_LOCK_TIMEOUT} seconds"
|
64
67
|
ensure
|
65
68
|
socket_lock.close if socket_lock
|
66
69
|
end
|
@@ -100,28 +103,23 @@ module Selenium
|
|
100
103
|
@binary.wait
|
101
104
|
end
|
102
105
|
|
103
|
-
def connect
|
104
|
-
@connection = ExtensionConnection.new(@host, @port)
|
105
|
-
@connection.connect(5)
|
106
|
-
end
|
107
|
-
|
108
106
|
def connect_until_stable
|
109
|
-
max_time = Time.now +
|
107
|
+
max_time = Time.now + STABLE_CONNECTION_TIMEOUT
|
110
108
|
|
111
109
|
until Time.now >= max_time
|
112
|
-
|
113
|
-
|
114
|
-
connection.connect(1)
|
115
|
-
|
116
|
-
connect
|
117
|
-
return
|
118
|
-
rescue Timeout::Error => e
|
119
|
-
puts "#{self} caught #{e.message}" if $DEBUG
|
120
|
-
# ok
|
121
|
-
end
|
110
|
+
return if can_connect?
|
111
|
+
sleep 0.25
|
122
112
|
end
|
123
113
|
|
124
|
-
raise Error::WebDriverError, "unable to obtain stable firefox connection"
|
114
|
+
raise Error::WebDriverError, "unable to obtain stable firefox connection in #{STABLE_CONNECTION_TIMEOUT} seconds"
|
115
|
+
end
|
116
|
+
|
117
|
+
def can_connect?
|
118
|
+
TCPSocket.new(@host, @port).close
|
119
|
+
true
|
120
|
+
rescue Errno::ECONNREFUSED, Errno::ENOTCONN, SocketError => e
|
121
|
+
$stderr.puts "#{e.message} for #{@host}:#{@port}" if $DEBUG
|
122
|
+
false
|
125
123
|
end
|
126
124
|
|
127
125
|
def free_port?(port)
|
@@ -6,7 +6,7 @@ module Selenium
|
|
6
6
|
ANONYMOUS_PROFILE_NAME = "WEBDRIVER_ANONYMOUS_PROFILE"
|
7
7
|
EXTENSION_NAME = "fxdriver@googlecode.com"
|
8
8
|
EM_NAMESPACE_URI = "http://www.mozilla.org/2004/em-rdf#"
|
9
|
-
NO_FOCUS_LIBRARY_NAME = "
|
9
|
+
NO_FOCUS_LIBRARY_NAME = "libnoblur.so"
|
10
10
|
|
11
11
|
DEFAULT_EXTENSION_SOURCE = File.expand_path("#{WebDriver.root}/firefox/src/extension")
|
12
12
|
|
@@ -16,15 +16,19 @@ module Selenium
|
|
16
16
|
["#{WebDriver.root}/firefox/prebuilt/nsIResponseHandler.xpt", "components/nsIResponseHandler.xpt"],
|
17
17
|
]
|
18
18
|
|
19
|
-
NATIVE_WINDOWS = [
|
19
|
+
NATIVE_WINDOWS = [
|
20
|
+
"#{WebDriver.root}/firefox/prebuilt/Win32/Release/webdriver-firefox.dll",
|
21
|
+
"platform/WINNT_x86-msvc/components/webdriver-firefox.dll"
|
22
|
+
]
|
23
|
+
|
20
24
|
NATIVE_LINUX = [
|
21
25
|
["#{WebDriver.root}/firefox/prebuilt/linux/Release/libwebdriver-firefox.so", "platform/Linux_x86-gcc3/components/libwebdriver-firefox.so"],
|
22
26
|
["#{WebDriver.root}/firefox/prebuilt/linux64/Release/libwebdriver-firefox.so", "platform/Linux_x86_64-gcc3/components/libwebdriver-firefox.so"]
|
23
27
|
]
|
24
28
|
|
25
29
|
NO_FOCUS = [
|
26
|
-
["#{WebDriver.root}/firefox/prebuilt/
|
27
|
-
["#{WebDriver.root}/firefox/prebuilt/
|
30
|
+
["#{WebDriver.root}/firefox/prebuilt/amd64/libnoblur64.so", "amd64/#{NO_FOCUS_LIBRARY_NAME}"],
|
31
|
+
["#{WebDriver.root}/firefox/prebuilt/i386/libnoblur.so", "x86/#{NO_FOCUS_LIBRARY_NAME}"],
|
28
32
|
]
|
29
33
|
|
30
34
|
SHARED = [
|
@@ -288,4 +292,4 @@ module Selenium
|
|
288
292
|
end # Profile
|
289
293
|
end # Firefox
|
290
294
|
end # WebDriver
|
291
|
-
end # Selenium
|
295
|
+
end # Selenium
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 20
|
9
|
+
version: 0.0.20
|
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-
|
17
|
+
date: 2010-06-03 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -210,7 +210,6 @@ files:
|
|
210
210
|
- firefox/src/rb/lib/selenium/webdriver/firefox.rb
|
211
211
|
- firefox/src/rb/lib/selenium/webdriver/firefox/binary.rb
|
212
212
|
- firefox/src/rb/lib/selenium/webdriver/firefox/bridge.rb
|
213
|
-
- firefox/src/rb/lib/selenium/webdriver/firefox/extension_connection.rb
|
214
213
|
- firefox/src/rb/lib/selenium/webdriver/firefox/launcher.rb
|
215
214
|
- firefox/src/rb/lib/selenium/webdriver/firefox/profile.rb
|
216
215
|
- firefox/src/rb/lib/selenium/webdriver/firefox/profiles_ini.rb
|
@@ -243,10 +242,10 @@ files:
|
|
243
242
|
- firefox/prebuilt/nsICommandProcessor.xpt
|
244
243
|
- firefox/prebuilt/nsINativeEvents.xpt
|
245
244
|
- firefox/prebuilt/nsIResponseHandler.xpt
|
245
|
+
- firefox/prebuilt/amd64/libnoblur64.so
|
246
|
+
- firefox/prebuilt/i386/libnoblur.so
|
246
247
|
- firefox/prebuilt/linux/Release/libwebdriver-firefox.so
|
247
|
-
- firefox/prebuilt/linux/Release/x_ignore_nofocus.so
|
248
248
|
- firefox/prebuilt/linux64/Release/libwebdriver-firefox.so
|
249
|
-
- firefox/prebuilt/linux64/Release/x_ignore_nofocus.so
|
250
249
|
- firefox/prebuilt/Win32/Release/webdriver-firefox.dll
|
251
250
|
- chrome/src/rb/lib/selenium/webdriver/chrome.rb
|
252
251
|
- chrome/src/rb/lib/selenium/webdriver/chrome/bridge.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Selenium
|
2
|
-
module WebDriver
|
3
|
-
module Firefox
|
4
|
-
|
5
|
-
# @private
|
6
|
-
class ExtensionConnection
|
7
|
-
|
8
|
-
def initialize(host, port)
|
9
|
-
@host = host
|
10
|
-
@port = port
|
11
|
-
end
|
12
|
-
|
13
|
-
def url
|
14
|
-
"http://#{@host}:#{@port}/hub"
|
15
|
-
end
|
16
|
-
|
17
|
-
def connect(timeout = 20)
|
18
|
-
Timeout.timeout(timeout) {
|
19
|
-
loop do
|
20
|
-
begin
|
21
|
-
return TCPSocket.new(@host, @port).close
|
22
|
-
rescue Errno::ECONNREFUSED, Errno::ENOTCONN, SocketError => e
|
23
|
-
$stderr.puts "#{self} caught #{e.message} for #{@host}:#{@port}" if $DEBUG
|
24
|
-
sleep 0.25
|
25
|
-
end
|
26
|
-
end
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
end # ExtensionConnection
|
31
|
-
end # Firefox
|
32
|
-
end # WebDriver
|
33
|
-
end # Selenium
|