Skip to content

Commit f482acb

Browse files
committed
Fixing ability to kill a browser driven in legacy mode (Grid does it on timeout). Not sure how should we deal with geckodriver in this case.
1 parent 1c813e0 commit f482acb

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@
1818
package org.openqa.selenium.firefox;
1919

2020
import static org.openqa.selenium.firefox.FirefoxOptions.FIREFOX_OPTIONS;
21-
import static org.openqa.selenium.remote.CapabilityType.ACCEPT_SSL_CERTS;
22-
import static org.openqa.selenium.remote.CapabilityType.LOGGING_PREFS;
2321
import static org.openqa.selenium.remote.CapabilityType.PROXY;
24-
import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_WEB_STORAGE;
2522

26-
import com.google.common.base.Preconditions;
2723
import com.google.common.collect.ImmutableMap;
2824
import com.google.common.collect.Maps;
2925
import com.google.common.collect.Sets;
@@ -38,7 +34,6 @@
3834
import org.openqa.selenium.internal.Lock;
3935
import org.openqa.selenium.internal.SocketLock;
4036
import org.openqa.selenium.logging.LocalLogs;
41-
import org.openqa.selenium.logging.LoggingPreferences;
4237
import org.openqa.selenium.logging.NeedsLocalLogs;
4338
import org.openqa.selenium.remote.BeanToJsonConverter;
4439
import org.openqa.selenium.remote.Command;
@@ -63,10 +58,9 @@
6358
* {@link FirefoxOptions}, like so:
6459
*
6560
* <pre>
66-
*DesiredCapabilities caps = new FirefoxOptions()
67-
* .setProfile(new FirefoxProfile())
68-
* .addTo(DesiredCapabilities.firefox());
69-
*WebDriver driver = new FirefoxDriver(caps);
61+
*FirefoxOptions options = new FirefoxOptions()
62+
* .setProfile(new FirefoxProfile());
63+
*WebDriver driver = new FirefoxDriver(options);
7064
* </pre>
7165
*/
7266
public class FirefoxDriver extends RemoteWebDriver implements Killable {
@@ -123,9 +117,8 @@ public static final class SystemProperty {
123117
protected FirefoxBinary binary;
124118

125119
// TODO: make it public as soon as it's fully implemented
126-
FirefoxDriver(FirefoxOptions options) {
120+
public FirefoxDriver(FirefoxOptions options) {
127121
this(toExecutor(options), options.toDesiredCapabilities(), options.toRequiredCapabilities());
128-
//binary = options.getBinary();
129122
}
130123

131124
private static CommandExecutor toExecutor(FirefoxOptions options) {
@@ -264,7 +257,9 @@ public void setFileDetector(FileDetector detector) {
264257
* stopped responding, and you don't want to leak resources. Should not ordinarily be called.
265258
*/
266259
public void kill() {
267-
binary.quit();
260+
if (this.getCommandExecutor() instanceof LazyCommandExecutor) {
261+
((LazyCommandExecutor) this.getCommandExecutor()).binary.quit();
262+
}
268263
}
269264

270265
@Override

0 commit comments

Comments
 (0)