我正在寻找一个链接来获取 Microsoft Edge 的最新驱动程序版本号,类似于 Google Chrome 的链接:https://chromedriver.storage.googleapis.com/LATEST_RELEASE https://chromedriver.storage.googleapis.com/LATEST_RELEASE
我有一个返回版本号字符串的函数。然后,我可以创建一个下载链接,如下所示:
private String getLatestChromeDriverVersion(){
RestTemplate restTemplate = new RestTemplate();
String url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE";
return restTemplate.getForObject(url, String.class);
}
String chromeDownloadUrl = "https://chromedriver.storage.googleapis.com/" + getLatestChromeDriverVersion() + "/chromedriver_win32.zip";
我一直在寻找与 Edge 类似的东西,但我找不到任何东西。他们有这个页面用于下载驱动程序:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/但没有像 /latest 或 /stable 这样的东西。
有任何想法吗?
您可以通过这两个链接获取官方文档中给出的最新版本号:
https://msedgedriver.azureedge.net/LATEST_STABLE
and
https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/LATEST_STABLE
Note:它们都是返回一个文件,而不是像chrome那样直接返回版本号,需要从这个文件中获取版本号。
一个简单的演示:
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://msedgedriver.azureedge.net/LATEST_STABLE"))
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
String version = response.body().replaceAll("[^\\d|.]", "");
System.out.println(version);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)