Skip to content

Commit

Permalink
[cdp] Use se:cdpVersion if present
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Apr 12, 2021
1 parent 6fd3b9b commit dcc371d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public Class<HasDevTools> getDescribedInterface() {

@Override
public HasDevTools getImplementation(Capabilities caps, ExecuteMethod executeMethod) {
CdpInfo info = new CdpVersionFinder().match(caps.getBrowserVersion()).orElseGet(NoOpCdpInfo::new);
Object cdpVersion = caps.getCapability("se:cdpVersion");
String version = cdpVersion instanceof String ? (String) cdpVersion : caps.getBrowserVersion();

CdpInfo info = new CdpVersionFinder().match(version).orElseGet(NoOpCdpInfo::new);
Optional<DevTools> devTools = SeleniumCdpConnection.create(caps).map(conn -> new DevTools(info::getDomains, conn));

return () -> devTools.orElseThrow(() -> new IllegalStateException("Unable to create connection to " + caps));
Expand Down

0 comments on commit dcc371d

Please sign in to comment.