Skip to content

Commit 18fc634

Browse files
committed
[rb] toggle Selenium Manager execution output on exit code
1 parent ec2430e commit 18fc634

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

rb/lib/selenium/webdriver/common/selenium_manager.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def driver_path(driver_name)
3939
raise Error::WebDriverError, msg
4040
end
4141

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

@@ -73,13 +73,12 @@ def binary
7373
def run(command)
7474
WebDriver.logger.debug("Executing Process #{command}")
7575

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

79-
message = stdout.empty? ? stderr.gsub("\n\n", "\n") : stdout
80-
raise Error::WebDriverError, "\n#{message}"
81-
rescue StandardError => e
82-
raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.message}"
81+
stdout.gsub("INFO\t", '').strip
8382
end
8483
end
8584
end # SeleniumManager

0 commit comments

Comments
 (0)