File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
java/client/src/org/openqa/selenium/firefox Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,12 @@ private static final CommandExecutor createCommandExecutor(Capabilities desiredC
255
255
if (isLegacy (desiredCapabilities )) {
256
256
return new LazyCommandExecutor (binary , profile );
257
257
}
258
- GeckoDriverService .Builder builder = new GeckoDriverService .Builder ();
258
+ GeckoDriverService .Builder builder ;
259
+ if (binary == null ) {
260
+ builder = new GeckoDriverService .Builder ();
261
+ } else {
262
+ builder = new GeckoDriverService .Builder (binary );
263
+ }
259
264
builder .usingPort (0 );
260
265
return new DriverCommandExecutor (builder .build ());
261
266
}
Original file line number Diff line number Diff line change 25
25
import org .openqa .selenium .WebDriverException ;
26
26
import org .openqa .selenium .net .PortProber ;
27
27
import org .openqa .selenium .firefox .internal .Executable ;
28
- import org .openqa .selenium .os .CommandLine ;
29
28
import org .openqa .selenium .remote .service .DriverService ;
30
29
31
30
import java .io .File ;
@@ -79,6 +78,18 @@ protected void waitUntilAvailable() throws MalformedURLException {
79
78
public static class Builder extends DriverService .Builder <
80
79
GeckoDriverService , GeckoDriverService .Builder > {
81
80
81
+ private Executable binary ;
82
+ public Builder () {
83
+ this (new FirefoxBinary ());
84
+ }
85
+
86
+ /**
87
+ * @param binary - A custom location where the Firefox binary is available.
88
+ */
89
+ public Builder (FirefoxBinary binary ) {
90
+ this .binary = binary .getExecutable ();
91
+ }
92
+
82
93
@ Override
83
94
protected File findDefaultExecutable () {
84
95
return findExecutable (
@@ -95,9 +106,8 @@ protected ImmutableList<String> createArgs() {
95
106
argsBuilder .add (String .format ("--log-file=\" %s\" " , getLogFile ().getAbsolutePath ()));
96
107
}
97
108
try {
98
- Executable firefoxExe = new Executable (null );
99
109
argsBuilder .add ("-b" );
100
- argsBuilder .add (firefoxExe .getPath ());
110
+ argsBuilder .add (binary .getPath ());
101
111
} catch (WebDriverException e ) {
102
112
// Unable to find Firefox. GeckoDriver will be responsible for finding
103
113
// Firefox on the PATH or via a capability.
You can’t perform that action at this time.
0 commit comments