selenium-webdriver 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/chrome/src/rb/lib/selenium/webdriver/chrome/bridge.rb +1 -0
- data/chrome/src/rb/lib/selenium/webdriver/chrome/command_executor.rb +7 -0
- data/chrome/src/rb/lib/selenium/webdriver/chrome/launcher.rb +1 -0
- data/common/src/rb/lib/selenium/webdriver/child_process.rb +17 -8
- data/common/src/rb/lib/selenium/webdriver/platform.rb +4 -0
- data/firefox/src/rb/lib/selenium/webdriver/firefox/binary.rb +29 -3
- data/firefox/src/rb/lib/selenium/webdriver/firefox/extension_connection.rb +1 -1
- data/firefox/src/rb/lib/selenium/webdriver/firefox/launcher.rb +1 -0
- metadata +2 -2
@@ -28,6 +28,11 @@ module Selenium
|
|
28
28
|
JSON.parse read_response(@queue.pop)
|
29
29
|
end
|
30
30
|
|
31
|
+
def close
|
32
|
+
@server.close
|
33
|
+
rescue IOError
|
34
|
+
end
|
35
|
+
|
31
36
|
private
|
32
37
|
|
33
38
|
def start_run_loop
|
@@ -42,6 +47,8 @@ module Selenium
|
|
42
47
|
|
43
48
|
@accepted_any ||= true
|
44
49
|
end
|
50
|
+
rescue IOError => e
|
51
|
+
raise e unless @server.closed?
|
45
52
|
end
|
46
53
|
|
47
54
|
def read_response(socket)
|
@@ -6,6 +6,8 @@ module Selenium
|
|
6
6
|
#
|
7
7
|
|
8
8
|
class ChildProcess
|
9
|
+
attr_reader :pid
|
10
|
+
|
9
11
|
def initialize(*args)
|
10
12
|
@args = args
|
11
13
|
|
@@ -16,14 +18,15 @@ module Selenium
|
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
def
|
20
|
-
|
21
|
+
def ugly_death?
|
22
|
+
code = exit_value()
|
23
|
+
# if exit_val is nil, the process is still alive
|
24
|
+
code && code != 0
|
25
|
+
end
|
21
26
|
|
22
|
-
|
23
|
-
Process.
|
24
|
-
|
25
|
-
rescue Errno::ESRCH
|
26
|
-
false
|
27
|
+
def exit_value
|
28
|
+
pid, status = Process.waitpid2(@pid, Process::WNOHANG)
|
29
|
+
status.exitstatus if pid
|
27
30
|
end
|
28
31
|
|
29
32
|
def start
|
@@ -34,7 +37,7 @@ module Selenium
|
|
34
37
|
|
35
38
|
def wait
|
36
39
|
raise "called wait with no pid" unless @pid
|
37
|
-
Process.
|
40
|
+
Process.waitpid2 @pid
|
38
41
|
end
|
39
42
|
|
40
43
|
def kill
|
@@ -78,6 +81,12 @@ module Selenium
|
|
78
81
|
def wait
|
79
82
|
@process.waitFor
|
80
83
|
end
|
84
|
+
|
85
|
+
def exit_value
|
86
|
+
@process.exitValue
|
87
|
+
rescue java.lang.IllegalThreadStateException
|
88
|
+
nil
|
89
|
+
end
|
81
90
|
end
|
82
91
|
|
83
92
|
end # ChildProcess
|
@@ -2,6 +2,7 @@ module Selenium
|
|
2
2
|
module WebDriver
|
3
3
|
module Firefox
|
4
4
|
class Binary
|
5
|
+
|
5
6
|
def initialize
|
6
7
|
ENV['MOZ_NO_REMOTE'] = '1' # able to launch multiple instances
|
7
8
|
check_binary_exists
|
@@ -9,10 +10,14 @@ module Selenium
|
|
9
10
|
|
10
11
|
def create_base_profile(name)
|
11
12
|
execute("-CreateProfile", name)
|
12
|
-
Timeout.timeout(15, Error::TimeOutError) { wait }
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
status = nil
|
15
|
+
Timeout.timeout(15, Error::TimeOutError) do
|
16
|
+
_, status = wait
|
17
|
+
end
|
18
|
+
|
19
|
+
if status && !status.success?
|
20
|
+
raise Error::WebDriverError, "could not create base profile: (exit status: #{status.exitstatus})"
|
16
21
|
end
|
17
22
|
end
|
18
23
|
|
@@ -25,6 +30,7 @@ module Selenium
|
|
25
30
|
# end
|
26
31
|
|
27
32
|
execute(*args)
|
33
|
+
cope_with_mac_strangeness(args) if Platform.mac?
|
28
34
|
end
|
29
35
|
|
30
36
|
def execute(*extra_args)
|
@@ -32,6 +38,22 @@ module Selenium
|
|
32
38
|
@process = ChildProcess.new(*args).start
|
33
39
|
end
|
34
40
|
|
41
|
+
def cope_with_mac_strangeness(args)
|
42
|
+
sleep 0.3
|
43
|
+
|
44
|
+
if @process.ugly_death?
|
45
|
+
# process crashed, trying a restart. sleeping 5 seconds shorter than the java driver
|
46
|
+
sleep 5
|
47
|
+
execute(*args)
|
48
|
+
end
|
49
|
+
|
50
|
+
# ensure we're ok
|
51
|
+
sleep 0.3
|
52
|
+
if @process.ugly_death?
|
53
|
+
raise Error::WebDriverError, "Unable to start Firefox cleanly, args: #{args.inspect}, status: #{status.inspect}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
35
57
|
def kill
|
36
58
|
@process.kill if @process
|
37
59
|
end
|
@@ -40,6 +62,10 @@ module Selenium
|
|
40
62
|
@process.wait if @process
|
41
63
|
end
|
42
64
|
|
65
|
+
def pid
|
66
|
+
@process.pid if @process
|
67
|
+
end
|
68
|
+
|
43
69
|
private
|
44
70
|
|
45
71
|
def path
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-webdriver
|
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
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-17 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|