2121
2222import com .google .auto .service .AutoService ;
2323import java .util .Optional ;
24+ import java .util .logging .Level ;
25+ import java .util .logging .Logger ;
2426import org .openqa .selenium .Capabilities ;
2527import org .openqa .selenium .ImmutableCapabilities ;
2628import org .openqa .selenium .SessionNotCreatedException ;
2931import org .openqa .selenium .WebDriverInfo ;
3032import org .openqa .selenium .chromium .ChromiumDriverInfo ;
3133import org .openqa .selenium .remote .CapabilityType ;
34+ import org .openqa .selenium .remote .NoSuchDriverException ;
3235import org .openqa .selenium .remote .service .DriverFinder ;
3336
3437@ AutoService (WebDriverInfo .class )
3538public class ChromeDriverInfo extends ChromiumDriverInfo {
39+ private static final Logger LOG = Logger .getLogger (ChromeDriverInfo .class .getName ());
3640
3741 @ Override
3842 public String getDisplayName () {
@@ -64,7 +68,10 @@ public boolean isAvailable() {
6468 try {
6569 DriverFinder .getPath (ChromeDriverService .createDefaultService (), getCanonicalCapabilities ());
6670 return true ;
71+ } catch (NoSuchDriverException e ) {
72+ return false ;
6773 } catch (IllegalStateException | WebDriverException e ) {
74+ LOG .log (Level .WARNING , "failed to discover driver path" , e );
6875 return false ;
6976 }
7077 }
@@ -75,7 +82,10 @@ public boolean isPresent() {
7582 DriverFinder .getPath (
7683 ChromeDriverService .createDefaultService (), getCanonicalCapabilities (), true );
7784 return true ;
85+ } catch (NoSuchDriverException e ) {
86+ return false ;
7887 } catch (IllegalStateException | WebDriverException e ) {
88+ LOG .log (Level .WARNING , "failed to discover driver path" , e );
7989 return false ;
8090 }
8191 }
0 commit comments