2727import org .openqa .selenium .devtools .DevTools ;
2828import org .openqa .selenium .devtools .DevToolsException ;
2929import org .openqa .selenium .devtools .HasDevTools ;
30+ import org .openqa .selenium .devtools .noop .NoOpCdpInfo ;
3031import org .openqa .selenium .html5 .LocalStorage ;
3132import org .openqa .selenium .html5 .Location ;
3233import org .openqa .selenium .html5 .LocationContext ;
4748
4849import java .util .Map ;
4950import java .util .Optional ;
51+ import java .util .logging .Logger ;
5052
5153/**
5254 * A {@link WebDriver} implementation that controls a Chromium browser running on the local machine.
6668public class ChromiumDriver extends RemoteWebDriver
6769 implements HasDevTools , HasTouchScreen , LocationContext , NetworkConnection , WebStorage {
6870
71+ private static final Logger LOG = Logger .getLogger (ChromiumDriver .class .getName ());
6972 private final RemoteLocationContext locationContext ;
7073 private final RemoteWebStorage webStorage ;
7174 private final TouchScreen touchScreen ;
@@ -87,15 +90,18 @@ protected ChromiumDriver(CommandExecutor commandExecutor, Capabilities capabilit
8790 capabilityKey );
8891
8992 CdpInfo cdpInfo = new CdpVersionFinder ().match (getCapabilities ().getVersion ())
90- .orElseThrow (() ->
91- new DevToolsException (String .format (
92- "Unable to find version of CDP to use for %s. You may need to " +
93- "include a dependency on a specific version of the CDP using " +
94- "something similar to " +
95- "`org.seleniumhq.selenium:selenium-devtools:86` where the " +
96- "version matches the version of the chromium-based browser " +
97- "you're using." ,
98- capabilities .getVersion ())));
93+ .orElseGet (() -> {
94+ LOG .warning (
95+ String .format (
96+ "Unable to find version of CDP to use for %s. You may need to " +
97+ "include a dependency on a specific version of the CDP using " +
98+ "something similar to " +
99+ "`org.seleniumhq.selenium:selenium-devtools:86` where the " +
100+ "version matches the version of the chromium-based browser " +
101+ "you're using." ,
102+ capabilities .getVersion ()));
103+ return new NoOpCdpInfo ();
104+ });
99105
100106 devTools = connection .map (conn -> new DevTools (cdpInfo .getDomains (), conn ));
101107 }
0 commit comments