我是 selenium 新手,并且一直坚持在 chrome 中启动 URL。
selenium.chrome.ChromeDriver; 这是代码片段
import java.time.Duration;
import org.openqa.selenium.WebDriver;
import org.openqa.
import io.github.bonigarcia.wdm.WebDriverManager;
public class GoogleTest {
public static void main(String[] args) {
WebDriverManager.chromedriver().clearDriverCache().setup();
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
driver.manage().window().maximize();
driver.get("https://google.com");
}
}
我看到以下错误
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.
(session not created: DevToolsActivePort file doesn't exist)
(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Chrome 浏览器由我的组织管理。我尝试从注册表编辑器中删除策略,但无法解决此问题。即使将值设置为 0 后,策略也会不断重新出现。如果有人知道这个问题,请帮忙。
WebDriver使用ChromeDriver所以你需要下载它