|
31 | 31 | import java.util.logging.Logger;
|
32 | 32 |
|
33 | 33 | import org.openqa.selenium.Beta;
|
| 34 | +import org.openqa.selenium.BuildInfo; |
34 | 35 | import org.openqa.selenium.Capabilities;
|
35 | 36 | import org.openqa.selenium.MutableCapabilities;
|
36 | 37 | import org.openqa.selenium.Platform;
|
@@ -58,28 +59,29 @@ public class SeleniumManager {
|
58 | 59 | private static final Logger LOG = Logger.getLogger(SeleniumManager.class.getName());
|
59 | 60 |
|
60 | 61 |
|
61 |
| - // IMPORTANT: This version needs to be synchronized before each release. |
62 |
| - // Alternatively, we can try to use Bazel to automate this task |
63 |
| - private static final String SELENIUM_MANAGER_VERSION = "0.4.12"; |
64 |
| - |
65 | 62 | private static final String SELENIUM_MANAGER = "selenium-manager";
|
66 | 63 | private static final String DEFAULT_CACHE_PATH = "~/.cache/selenium";
|
67 | 64 | private static final String BINARY_PATH_FORMAT = "/manager/%s/%s";
|
68 | 65 | private static final String HOME = "~";
|
69 | 66 | private static final String CACHE_PATH_ENV = "SE_CACHE_PATH";
|
| 67 | + private static final String BETA_PREFIX = "0."; |
70 | 68 |
|
71 | 69 | private static final String EXE = ".exe";
|
72 | 70 | private static final String INFO = "INFO";
|
73 | 71 | private static final String WARN = "WARN";
|
74 | 72 | private static final String DEBUG = "DEBUG";
|
75 | 73 |
|
76 | 74 | private static volatile SeleniumManager manager;
|
77 |
| - |
78 | 75 | private final String managerPath = System.getenv("SE_MANAGER_PATH");
|
79 | 76 | private Path binary = managerPath == null ? null : Paths.get(managerPath);
|
| 77 | + private String seleniumManagerVersion; |
80 | 78 |
|
81 | 79 | /** Wrapper for the Selenium Manager binary. */
|
82 | 80 | private SeleniumManager() {
|
| 81 | + BuildInfo info = new BuildInfo(); |
| 82 | + String releaseLabel = info.getReleaseLabel(); |
| 83 | + int lastDot = releaseLabel.lastIndexOf("."); |
| 84 | + seleniumManagerVersion = BETA_PREFIX + releaseLabel.substring(0, lastDot); |
83 | 85 | }
|
84 | 86 |
|
85 | 87 | public static SeleniumManager getInstance() {
|
@@ -297,6 +299,6 @@ private Path getBinaryInCache(String binaryName) {
|
297 | 299 | cachePath = cachePathEnv;
|
298 | 300 | }
|
299 | 301 |
|
300 |
| - return Paths.get(cachePath + String.format(BINARY_PATH_FORMAT, SELENIUM_MANAGER_VERSION, binaryName)); |
| 302 | + return Paths.get(cachePath + String.format(BINARY_PATH_FORMAT, seleniumManagerVersion, binaryName)); |
301 | 303 | }
|
302 | 304 | }
|
0 commit comments