Skip to content

Commit

Permalink
Better logging from proxying CDP nodes when in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Apr 12, 2021
1 parent dcc371d commit d9ef528
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import static org.openqa.selenium.internal.Debug.getDebugLogLevel;
import static org.openqa.selenium.remote.http.HttpMethod.GET;

public class ProxyNodeCdp implements BiFunction<String, Consumer<Message>, Optional<Consumer<Message>>> {
Expand Down Expand Up @@ -78,20 +79,23 @@ public Optional<Consumer<Message>> apply(String uri, Consumer<Message> downstrea
Optional<URI> cdpUri = CdpEndpointFinder.getReportedUri("goog:chromeOptions", caps)
.flatMap(reported -> CdpEndpointFinder.getCdpEndPoint(clientFactory, reported));
if (cdpUri.isPresent()) {
LOG.fine("Chrome endpoint found");
LOG.log(getDebugLogLevel(), "Chrome endpoint found");
return cdpUri.map(cdp -> createCdpEndPoint(cdp, downstream));
}

cdpUri = CdpEndpointFinder.getReportedUri("moz:debuggerAddress", caps)
.flatMap(reported -> CdpEndpointFinder.getCdpEndPoint(clientFactory, reported));
if (cdpUri.isPresent()) {
LOG.fine("Firefox endpoint found");
LOG.log(getDebugLogLevel(), "Firefox endpoint found");
return cdpUri.map(cdp -> createCdpEndPoint(cdp, downstream));
}

LOG.fine("Searching for edge options");
cdpUri = CdpEndpointFinder.getReportedUri("ms:edgeOptions", caps)
.flatMap(reported -> CdpEndpointFinder.getCdpEndPoint(clientFactory, reported));
if (cdpUri.isPresent()) {
LOG.log(getDebugLogLevel(), "Edge endpoint found");
}
return cdpUri.map(cdp -> createCdpEndPoint(cdp, downstream));
}

Expand Down

0 comments on commit d9ef528

Please sign in to comment.