@@ -33,6 +33,9 @@ class << self
33
33
# @param [Options] options browser options.
34
34
# @return [String] the path to the correct driver.
35
35
def driver_path ( options )
36
+ message = "driver for #{ options . browser_name } not found; attempting to install with Selenium Manager"
37
+ WebDriver . logger . warn ( message )
38
+
36
39
unless options . is_a? ( Options )
37
40
raise ArgumentError , "SeleniumManager requires a WebDriver::Options instance, not a #{ options . inspect } "
38
41
end
@@ -46,6 +49,7 @@ def driver_path(options)
46
49
command << '--browser-path'
47
50
command << "\" #{ options . binary . gsub ( '\ ' , ' ' ) . gsub ( ' ' , '\ ' ) } \" "
48
51
end
52
+ command << '--debug' if WebDriver . logger . debug?
49
53
50
54
location = run ( command . join ( ' ' ) )
51
55
WebDriver . logger . debug ( "Driver found at #{ location } " )
@@ -82,8 +86,8 @@ def run(command)
82
86
83
87
begin
84
88
stdout , stderr , status = Open3 . capture3 ( command )
85
- json_output = JSON . parse ( stdout )
86
- result = json_output [ 'result' ] [ 'message' ]
89
+ json_output = stdout . empty? ? nil : JSON . parse ( stdout )
90
+ result = json_output &. dig ( 'result' , 'message' )
87
91
rescue StandardError => e
88
92
raise Error ::WebDriverError , "Unsuccessful command executed: #{ command } " , e . message
89
93
end
@@ -93,7 +97,7 @@ def run(command)
93
97
end
94
98
95
99
json_output [ 'logs' ] . each do |log |
96
- WebDriver . logger . warn ( log [ 'message' ] ) if log [ 'level' ] == 'WARN'
100
+ WebDriver . logger . send ( log [ 'level' ] . downcase , log [ 'message' ] )
97
101
end
98
102
99
103
result
0 commit comments