io.github.bonigarcia.wdm.WebDriverManagerException: chromedr



似乎我的chromedriver没有被下面的代码更新:


import io.github.bonigarcia.wdm.WebDriverManager;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import testone2.firstTest;
import java.io.*;
public class testLogin {
protected WebDriver driver;
private int seconds;
public testLogin() {
super();
}
@BeforeTest
public void beforeTest() {
//Download the web driver executable
String chromeVersion = null;
try {
FileReader reader = new FileReader("chromeVersion.txt");
BufferedReader br = new BufferedReader(reader);
String line;
while ((line = br.readLine()) != null) {
chromeVersion = line.trim();
}
reader.close();
} catch (IOException e) {
Throwable ioException = new Throwable();
ioException.printStackTrace();
}
WebDriverManager.chromedriver().version(chromeVersion).setup();
boolean oldVersion = false;
try {
driver = new ChromeDriver();
} catch (Exception e) {
oldVersion = false;
String err = e.getMessage();
chromeVersion = err.split("version is")[1].split("with binary path")[0].trim();
try {
FileWriter writer = new FileWriter("chromeVersion.txt", true);
writer.write(chromeVersion);
writer.close();
} catch (IOException er) {
}
}

if (!oldVersion) {
WebDriverManager.chromedriver().version(chromeVersion).setup();
driver = new ChromeDriver();
}
}

public void sleep(int seconds) {
try {
Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

Chrome是版本88.0.4324.182(官方版本)(64位)和WebDriverManager的依赖是4.2.2

在控制台中返回:io.github.bonigarcia.wdm.WebDriverManagerException: io.github.bonigarcia.wdm.WebDriverManagerException: chromedriver 88.0.4324.150 for WIN64 not found in https://chromedriver.storage.googleapis.com/

谁能指出,如果它的代码读取版本chromedriver的错误?这里的问题是什么?由于

通过设置chromeversion.txt为88.0.4324.96解决

最新更新