简体   繁体   中英

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

I am trying to Automate a regular procedure using Java with Selenium. I tried to use Chrome as my browser. But I am getting an error and can't able to load the browser.

Below is the error:

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 version used : Version 63.0.3239.132 (Official Build) (64-bit)

Code used:

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();

enter image description here

It seems your ChromeDriver doesn't support driver.manage().window().maximize();

Try ChromeOptions to achieve the same ...eg

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);

Update your ChromeDriver and chrome to latest version and try again.

I ran your code with ChromeDriver version 2.35 and chrome Version 64.0.3282.140 (Official Build) (64-bit) on my environment and there was no issue.

You can disable extensions via chromeoptions.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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