|
21 | 21 |
|
22 | 22 | import com.google.auto.service.AutoService; |
23 | 23 | import java.util.Optional; |
24 | | -import java.util.logging.Level; |
25 | 24 | import java.util.logging.Logger; |
26 | 25 | import org.openqa.selenium.Capabilities; |
27 | 26 | import org.openqa.selenium.ImmutableCapabilities; |
28 | 27 | import org.openqa.selenium.SessionNotCreatedException; |
29 | 28 | import org.openqa.selenium.WebDriver; |
30 | | -import org.openqa.selenium.WebDriverException; |
31 | 29 | import org.openqa.selenium.WebDriverInfo; |
32 | 30 | import org.openqa.selenium.chromium.ChromiumDriverInfo; |
33 | 31 | import org.openqa.selenium.remote.CapabilityType; |
34 | | -import org.openqa.selenium.remote.NoSuchDriverException; |
35 | 32 | import org.openqa.selenium.remote.service.DriverFinder; |
36 | 33 |
|
37 | 34 | @AutoService(WebDriverInfo.class) |
@@ -65,29 +62,14 @@ public boolean isSupportingBiDi() { |
65 | 62 |
|
66 | 63 | @Override |
67 | 64 | public boolean isAvailable() { |
68 | | - try { |
69 | | - DriverFinder.getPath(ChromeDriverService.createDefaultService(), getCanonicalCapabilities()); |
70 | | - return true; |
71 | | - } catch (NoSuchDriverException e) { |
72 | | - return false; |
73 | | - } catch (IllegalStateException | WebDriverException e) { |
74 | | - LOG.log(Level.WARNING, "failed to discover driver path", e); |
75 | | - return false; |
76 | | - } |
| 65 | + return new DriverFinder(ChromeDriverService.createDefaultService(), getCanonicalCapabilities()) |
| 66 | + .isAvailable(); |
77 | 67 | } |
78 | 68 |
|
79 | 69 | @Override |
80 | 70 | public boolean isPresent() { |
81 | | - try { |
82 | | - DriverFinder.getPath( |
83 | | - ChromeDriverService.createDefaultService(), getCanonicalCapabilities(), true); |
84 | | - return true; |
85 | | - } catch (NoSuchDriverException e) { |
86 | | - return false; |
87 | | - } catch (IllegalStateException | WebDriverException e) { |
88 | | - LOG.log(Level.WARNING, "failed to discover driver path", e); |
89 | | - return false; |
90 | | - } |
| 71 | + return new DriverFinder(ChromeDriverService.createDefaultService(), getCanonicalCapabilities()) |
| 72 | + .isPresent(); |
91 | 73 | } |
92 | 74 |
|
93 | 75 | @Override |
|
0 commit comments