@@ -33,6 +33,9 @@ class << self
3333 # @param [Options] options browser options.
3434 # @return [String] the path to the correct driver.
3535 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+
3639 unless options . is_a? ( Options )
3740 raise ArgumentError , "SeleniumManager requires a WebDriver::Options instance, not a #{ options . inspect } "
3841 end
@@ -46,6 +49,7 @@ def driver_path(options)
4649 command << '--browser-path'
4750 command << "\" #{ options . binary . gsub ( '\ ' , ' ' ) . gsub ( ' ' , '\ ' ) } \" "
4851 end
52+ command << '--debug' if WebDriver . logger . debug?
4953
5054 location = run ( command . join ( ' ' ) )
5155 WebDriver . logger . debug ( "Driver found at #{ location } " )
@@ -82,8 +86,8 @@ def run(command)
8286
8387 begin
8488 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' )
8791 rescue StandardError => e
8892 raise Error ::WebDriverError , "Unsuccessful command executed: #{ command } " , e . message
8993 end
@@ -93,7 +97,7 @@ def run(command)
9397 end
9498
9599 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' ] )
97101 end
98102
99103 result
0 commit comments