|
23 | 23 | import static org.openqa.selenium.remote.CapabilityType.ACCEPT_SSL_CERTS;
|
24 | 24 | import static org.openqa.selenium.remote.CapabilityType.LOGGING_PREFS;
|
25 | 25 | import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_WEB_STORAGE;
|
| 26 | +import static org.openqa.selenium.remote.CapabilityType.VERSION; |
26 | 27 |
|
27 | 28 | import com.google.common.base.Joiner;
|
28 | 29 | import com.google.common.base.Preconditions;
|
|
33 | 34 |
|
34 | 35 | import org.openqa.selenium.Capabilities;
|
35 | 36 | import org.openqa.selenium.SessionNotCreatedException;
|
36 |
| -import org.openqa.selenium.WebDriver; |
37 | 37 | import org.openqa.selenium.WebDriverException;
|
38 | 38 | import org.openqa.selenium.firefox.internal.ProfilesIni;
|
39 | 39 | import org.openqa.selenium.logging.LoggingPreferences;
|
40 |
| -import org.openqa.selenium.remote.CapabilityType; |
41 | 40 | import org.openqa.selenium.remote.DesiredCapabilities;
|
42 | 41 |
|
43 |
| -import sun.awt.image.ByteInterleavedRaster; |
44 |
| - |
45 | 42 | import java.io.File;
|
46 | 43 | import java.io.IOException;
|
47 | 44 | import java.nio.file.Path;
|
48 | 45 | import java.nio.file.Paths;
|
49 | 46 | import java.util.ArrayList;
|
50 | 47 | import java.util.Collection;
|
51 |
| -import java.util.Collections; |
52 | 48 | import java.util.HashMap;
|
53 | 49 | import java.util.List;
|
54 | 50 | import java.util.Map;
|
@@ -224,14 +220,14 @@ private Optional<FirefoxBinary> determineBinaryFromCapabilities(Capabilities cap
|
224 | 220 | }
|
225 | 221 | }
|
226 | 222 |
|
227 |
| - if (caps.getCapability(CapabilityType.VERSION) != null) { |
| 223 | + Object rawVersion = caps.getCapability(VERSION); |
| 224 | + if (rawVersion != null && !"".equals(rawVersion)) { |
228 | 225 | try {
|
229 |
| - FirefoxBinary.Channel channel = FirefoxBinary.Channel.fromString( |
230 |
| - (String) caps.getCapability(CapabilityType.VERSION)); |
| 226 | + FirefoxBinary.Channel channel = |
| 227 | + FirefoxBinary.Channel.fromString(String.valueOf(rawVersion)); |
231 | 228 | return Optional.of(new FirefoxBinary(channel));
|
232 | 229 | } catch (WebDriverException ex) {
|
233 |
| - return Optional.of(new FirefoxBinary( |
234 |
| - (String) caps.getCapability(CapabilityType.VERSION))); |
| 230 | + return Optional.of(new FirefoxBinary(String.valueOf(rawVersion))); |
235 | 231 | }
|
236 | 232 | }
|
237 | 233 |
|
|
0 commit comments