简体   繁体   English

线程“main”中的异常 org.openqa.selenium.WebDriverException:驱动程序服务器进程过早死亡

[英]Exception in thread "main" org.openqa.selenium.WebDriverException: Driver server process died prematurely

I'm trying to create a new project with selenium but I got this error:我正在尝试使用 selenium 创建一个新项目,但出现此错误:

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.
Exception in thread "main" org.openqa.selenium.WebDriverException: Driver server process died prematurely.
Build info: version: '4.0.0-alpha-7', revision: 'de8579b6d5'
System info: host: 'Ginas-MacBook-Pro.local', ip: 'fe80:0:0:0:3b:f328:9854:2af1%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '11.0.1'
Driver info: driver.version: ChromeDriver
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:207)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:501)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:127)
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:93)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:163)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:105)
    at contactPolicy.com.gui.DriverSetup.main(DriverSetup.java:11)

Process finished with exit code 1

This is a new error for me and I try to figure out what happened.这对我来说是一个新错误,我试图弄清楚发生了什么。 this is my class to call the driver, this a maven project.这是我的 class 调用驱动程序,这是一个 maven 项目。

package contactPolicy.com.gui;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class DriverSetup {

    //Constructor
    public static void main (String [] args){
        System.setProperty("webdriver.chrome.driver","/Users/gicastano/IdeaProjects/contactPolicy/chromedriver");
        WebDriver driver = new ChromeDriver();
        driver.get("www.google.com");
    }

}

I tried a lot of solutions that I have been seen but still no success and I feel frustrated, I'll appreciate all help.我尝试了很多我见过的解决方案,但仍然没有成功,我感到很沮丧,我会很感激所有的帮助。 thanks!谢谢!

Is a maven project.是一个maven的项目。 This is my POM这是我的 POM

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>contactPolicy</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <!--Selenium
         https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>

         https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>


       https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>

        -->
        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.4.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>3.4.0</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>2.0.0-alpha4</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>2.0.0-alpha4</version>
            <scope>test</scope>
        </dependency>


    </dependencies>


</project>  

Everything was normal when I downgraded the version of selenium to 3.141.59把selenium的版本降到3.141.59就一切正常了

Code代码

public static void main(String[] args) {
    WebDriverManager.chromedriver().setup();
    WebDriver driver = new ChromeDriver();
    driver.get("https://www.google.com");
}

dependencies in pom.xml pom.xml 中的依赖项

<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>7.4.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>3.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>2.0.0-alpha4</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>2.0.0-alpha4</version>
        <scope>test</scope>
    </dependency>
</dependencies>

暂无
暂无

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

相关问题 端口无效。 Exiting..Exception in thread "main" org.openqa.selenium.WebDriverException: 驱动程序服务器进程过早死亡 ChromeDriver Selenium - Invalid port. Exiting..Exception in thread "main" org.openqa.selenium.WebDriverException: Driver server process died prematurely ChromeDriver Selenium Chrome 浏览器中的 Selenium 在线程“main”org.openqa.selenium.WebDriverException 中显示异常:等待驱动程序服务器启动超时 - Selenium in Chrome browser shows Exception in thread “main” org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start 线程“主” org.openqa.selenium.WebDriverException中的异常:无法访问Chrome - Exception in thread “main” org.openqa.selenium.WebDriverException: chrome not reachable 线程“主”org.openqa.selenium.WebDriverException 中的异常:权限被拒绝 - Exception in thread “main” org.openqa.selenium.WebDriverException: permission denied 如何修复线程“主”org.openqa.selenium.WebDriverException 中的异常? - How to fix Exception in thread “main” org.openqa.selenium.WebDriverException? 线程“主” org.openqa.selenium.WebDriverException中的异常:未定义$ - Exception in thread “main” org.openqa.selenium.WebDriverException: $ is not defined 线程“ main”中的异常org.openqa.selenium.WebDriverException - Exception in thread “main” org.openqa.selenium.WebDriverException 网络问题后“线程“主”org.openqa.selenium.WebDriverException 中的异常:无效参数:无法杀死已退出的进程 - "Exception in thread "main" org.openqa.selenium.WebDriverException: invalid argument: can't kill an exited process" after nework problems 线程“主”org.openqa.selenium.WebDriverException 中的异常:未知错误:使用 Selenium Java 的意外命令响应 - Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: unexpected command response using Selenium Java 线程“主” org.openqa.selenium.WebDriverException中的异常:未知错误:无法聚焦元素 - Exception in thread “main” org.openqa.selenium.WebDriverException: unknown error: cannot focus element
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM