Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] close the CDP connection on quit for FF #11109

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion java/src/org/openqa/selenium/firefox/FirefoxDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public class FirefoxDriver extends RemoteWebDriver
private final Optional<URI> cdpUri;
private final Optional<URI> biDiUri;
protected FirefoxBinary binary;
private Connection connection;
private DevTools devTools;
private BiDi biDi;
public FirefoxDriver() {
Expand Down Expand Up @@ -246,7 +247,7 @@ public Optional<DevTools> maybeGetDevTools() {
ClientConfig wsConfig = ClientConfig.defaultConfig().baseUri(wsUri);
HttpClient wsClient = clientFactory.createClient(wsConfig);

Connection connection = new Connection(wsClient, wsUri.toString());
connection = new Connection(wsClient, wsUri.toString());
CdpInfo cdpInfo = new CdpVersionFinder().match("85.0").orElseGet(NoOpCdpInfo::new);
devTools = new DevTools(cdpInfo::getDomains, connection);

Expand Down Expand Up @@ -298,6 +299,14 @@ public BiDi getBiDi() {
.orElseThrow(() -> new DevToolsException("Unable to initialize Bidi connection"));
}

@Override
public void quit() {
if (connection != null) {
connection.close();
}
super.quit();
}

public static final class SystemProperty {

/**
Expand Down