未知错误:Chrome无法启动:正常退出

时间:2020-10-31 05:16:52

标签: selenium selenium-webdriver selenium-chromedriver

我的Chrome版本是86.0.4240.111。

我的chromedriver版本是:86.0.4240.22

Java版本为1.8

在尝试运行我的Selenium脚本时,我的Chrome浏览器会打开,但不会启动url或其他任何内容。相反,我收到错误消息“ org.openqa.selenium.WebDriverException: 未知错误:Chrome无法启动:正常退出。”下面给出了详细的错误消息。

Starting ChromeDriver 86.0.4240.22 (398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/4240@{#378}) on port 48767
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
{"AppTitle":"Overall Test Execution Summary Report","reportItems":[]}
Execution Complete. Please view report file at: C:\Users\*******\Output/20201031102422\StatusReport.html
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.138 sec <<< FAILURE! - in TestSuite
testCaseExecutor(com.dlh.adcb1.tests.TestNGExecutor)  Time elapsed: 2.972 sec  <<< FAILURE!
org.openqa.selenium.WebDriverException: 
unknown error: Chrome failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '01HW1717242', ip: '10.221.93.41', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_271'
Driver info: driver.version: Driver
remote stacktrace: Backtrace:
    Ordinal0 [0x00BDC013+3194899]
    Ordinal0 [0x00AC6021+2056225]
    Ordinal0 [0x0095F608+587272]
    Ordinal0 [0x008DE5D2+58834]
    Ordinal0 [0x008DC64A+50762]
    Ordinal0 [0x00901EE9+204521]
    Ordinal0 [0x00901D0D+204045]
    Ordinal0 [0x008FFC1B+195611]
    Ordinal0 [0x008E3B7F+80767]
    Ordinal0 [0x008E4B4E+84814]
    Ordinal0 [0x008E4AD9+84697]
    Ordinal0 [0x00ADCE64+2149988]
    GetHandleVerifier [0x00D4BE95+1400773]
    GetHandleVerifier [0x00D4BB61+1399953]
    GetHandleVerifier [0x00D531FA+1430314]
    GetHandleVerifier [0x00D4C69F+1402831]
    Ordinal0 [0x00AD3D61+2112865]
    Ordinal0 [0x00ADE5CB+2155979]
    Ordinal0 [0x00ADE6F5+2156277]
    Ordinal0 [0x00AEF26E+2224750]
    BaseThreadInitThunk [0x755B6359+25]
    RtlGetAppContainerNamedObjectPath [0x77707C24+228]
    RtlGetAppContainerNamedObjectPath [0x77707BF4+180]

    at com.dlh.adcb1.tests.TestNGExecutor.testCaseExecutor(TestNGExecutor.java:139)


Results :

Failed tests: 
  TestNGExecutor.testCaseExecutor:139 » WebDriver unknown error: Chrome failed t...

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

ChromeOptions代码:

public WebDriver getDriver(TestDataBean testCaseData) throws InterruptedException, IOException {
        WebDriver driver = null;
        String browserSelected = testCaseData.getBrowser();
        log.info(browserSelected);
        if(browserSelected.equalsIgnoreCase("CHROME")) {
            log.info("Inside if loop");
            File driverDir = getExeForDriver("chromedriver.exe");
            log.info(driverDir);
            System.setProperty("webdriver.chrome.driver", driverDir.getAbsolutePath());
            log.info(driverDir.getAbsolutePath());

            ChromeOptions options = new ChromeOptions();
            options.addArguments("--no-sandbox");
            options.addArguments("--disable-notifications");
            options.addArguments("--disable-plugins-discovery");
            options.addArguments("--disable-extensions");
            options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
            options.addArguments("start-maximized"); // open Browser in maximized mode
            //options.addArguments("disable-infobars"); // disabling infobars
            options.addArguments("--disable-extensions"); // disabling extensions
            options.addArguments("--disable-gpu"); // applicable to windows os only
             // Bypass OS security model
            //options.addArguments("--remote-debugging-port=9222");
            //options.setExperimentalOption("debuggerAddress", "127.0.0.1:1111");

            // pass the options object in Chrome driver
            driver = new ChromeDriver(options);
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
            driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.MINUTES);
        }
        return driver;
    }

有人可以帮我解决这个问题吗?谢谢!

0 个答案:

没有答案
相关问题