System.setProperty("webdriver.chrome.whitelistedIps", "");
System.setProperty(driverName, driverPath);
//
ChromeOptions chromeOptions = new ChromeOptions();
// // 设置浏览器是否可见,启用无头模式
if(StringUtils.isNotEmpty(chromePath)){
chromeOptions.setBinary(chromePath);
}
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--disable-gpu");
chromeOptions.addArguments("--disable-dev-shm-usage");
chromeOptions.addArguments("--window-size=1024,768");
chromeOptions.addArguments("--remote-debugging-port=9522");
ChromeDriverService.Builder builder = new ChromeDriverService.Builder();
chromeDriverService = builder.usingDriverExecutable(new File(driverPath))
.usingPort(9522)
.build();
try {
chromeDriverService.start();
} catch (IOException e) {
throw new BusinessException(ErrorCode.SYSTEM_ERROR,e.getMessage());
}
//
WebDriver driver = new ChromeDriver(chromeDriverService,chromeOptions);
selenium-java 版本4.1.4
chromedriver和Chrome 版本131.0.6778.264
应该怎么解决这个问题