org.openqa.selenium.WebDriverException:未知错误:Chrome浏览器无法启动:崩溃,(chrome无法访问)

oknrviil  于 2023-01-20  发布在  其他
关注(0)|答案(1)|浏览(327)

未在Chrome上运行的Java脚本( selenium 框架)。
我试过所有可能的方法:
1.取消选中以管理员身份运行
1.添加参数
代码块:

ChromeOptions options = new ChromeOptions();
//options.setExperimentalOption("debuggerAddress", "127.0.0.1:9222");
options.setBinary("C:/Program Files/Google/Chrome/Application/chrome.exe");
options.addArguments("--no-sandbox");
options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments("start-maximized"); // open Browser in maximized mode
options.addArguments("--disable-extensions"); // disabling extensions
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--remote-debugging-port=9222");

Chrome版本:108.0.5359.125
selenium-java-3.141.59
selenium 服务器-3.4.0
我们正在使用Web驱动程序管理器
操作系统-win10
错误:

"C:\Program Files\Java\jdk1.8.0_351\bin\java.exe" -C:/Users/..../ISA/src/test/resources/Checklist/NFTE1_Confirm_login.feature
Testing started at 09:07 AM ...
inside chrome browser configuration
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 108.0.5359.71 (1e0e3868ee06e91ad636a874420e3ca3ae3756ac-refs/branch-heads/5359@{#1016}) on port 35499
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1674119263.153][WARNING]: Deprecated chrome option is ignored: useAutomationExtension
[1674119263.156][WARNING]: Deprecated chrome option is ignored: useAutomationExtension

Skipped step

Skipped step
Executed scenario successfully

Failed scenarios:
C:/Users/...../ISA/src/test/resources/Checklist/NFTE1_Confirm_login.feature:15 # Scenario Outline: Login to ISA

1 Scenarios (1 failed)
2 Steps (2 skipped)
0m20.488s

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed.
  (chrome not reachable)
  (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.)
7dl7o3gd

7dl7o3gd1#

用途:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.59</version>
</dependency>

或者您用途:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>3.4.0</version>
</dependency>

但不是两者都有。

相关问题