繁体   English   中英

线程“ main” org.openqa.selenium.WebDriverException中的异常:未知错误:Chrome无法启动:正常退出

[英]Exception in thread “main” org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally

我正在尝试使用带有Selenium的Java自动执行常规过程。 我试图使用Chrome浏览器。 但是我遇到错误,无法加载浏览器。

下面是错误:

Starting ChromeDriver (v2.3) on port 52793 Exception in thread "main"
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally (Driver info:  chromedriver=2.3,platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 22.50 seconds Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:03:00'

使用的Chrome版本 :63.0.3239.132版(官方内部版本)(64位)

使用的代码:

public static void main(String[] args) throws Throwable {   
System.setProperty("webdriver.chrome.driver", "D:\\Automation\\Thomas_Auto\\Driver\\chromedriver.exe");

ChromeDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://vrijuit.nl/nl/vakanties");
driver.findElement(By.cssSelector("i.basic-sprite.date")).click();
driver.findElement(By.xpath("(//a[contains(text(),'1')])[56]")).click();
driver.findElement(By.cssSelector("a.ui-state-default.ui-state-active.ui-state-hover")).click();
driver.findElement(By.linkText("info & prijs")).click();
driver.findElement(By.cssSelector("input.btn.btn-select")).click();
driver.findElement(By.cssSelector("button.btn-call-to-action")).click();

在此处输入图片说明

看来您的ChromeDriver不支持driver.manage().window().maximize();

尝试使用ChromeOptions实现相同的效果...例如

System.setProperty("webdriver.chrome.driver","D://Automation/Thomas_Auto/Driver/chromedriver.exe");
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.addArguments("disable-infobars");
        chromeOptions.addArguments("start-maximized");
        driver = new ChromeDriver(chromeOptions);

将您的ChromeDriver和Chrome更新到最新版本,然后重试。

我在我的环境中使用ChromeDriver 2.35版和chrome 64.0.3282.140版(正式版本)(64位)运行了您的代码,没有任何问题。

您可以通过chromeoptions禁用扩展名。

    ChromeOptions options = new ChromeOptions();
    options.addArguments("chrome.switches","--disable-extensions");
    ChromeDriver driver=new ChromeDriver(options);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM