Skip to content

Commit

Permalink
[rb] toggle Selenium Manager execution output on exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Nov 29, 2022
1 parent ec2430e commit 18fc634
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions rb/lib/selenium/webdriver/common/selenium_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def driver_path(driver_name)
raise Error::WebDriverError, msg
end

location = run("#{binary} --driver #{driver_name}").split("\t").last.strip
location = run("#{binary} --driver #{driver_name}")
WebDriver.logger.debug("Driver found at #{location}")
Platform.assert_executable location

Expand Down Expand Up @@ -73,13 +73,12 @@ def binary
def run(command)
WebDriver.logger.debug("Executing Process #{command}")

stdout, stderr, _status = Open3.capture3(command)
return stdout if stdout.match?(/^INFO\t/)
stdout, stderr, status = Open3.capture3(command)
if status.exitstatus.positive?
raise Error::WebDriverError, "Unsuccessful command executed: #{command}\n#{stdout}#{stderr}"
end

message = stdout.empty? ? stderr.gsub("\n\n", "\n") : stdout
raise Error::WebDriverError, "\n#{message}"
rescue StandardError => e
raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.message}"
stdout.gsub("INFO\t", '').strip
end
end
end # SeleniumManager
Expand Down

0 comments on commit 18fc634

Please sign in to comment.