I just converted my existing project to a maven project. I have added dependencies like selenium-java, selenium-serve, selenium-chrome-driver, testing, and JUnit.

It is a TestNG project that contains many packages and classes. It gives me an error as below:

Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract void loadSystemProperties()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder.
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:504)
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:162)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:52)

Dependencies I have added;

<dependencies>

        <!--
        https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.10.0</version>
        </dependency>

        <!--
        https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.9.0</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.9.0</version>
        </dependency>

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

        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>
                junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.6</version>
            <scope>test</scope>
        </dependency>


        <!--
        https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-support -->
        <dependency>
            <groupId>
                org.seleniumhq.selenium</groupId>
            <artifactId>selenium-support</artifactId>
            <version>
                4.10.0</version>
        </dependency>

        <!--
        https://mvnrepository.com/artifact/ru.stqa.selenium/webdriver-expected-conditions -->
        <dependency>
            <groupId>ru.stqa.selenium</groupId>
            <artifactId>
                webdriver-expected-conditions</artifactId>
            <version>1.0.41</version>
        </dependency>


    </dependencies>

Also I have added this line in my cod,

        System.setProperty("webdriver.chrome.driver", "path");
        WebDriver driver = new ChromeDriver();

Can anyone help me how to solve this error. What should I do?

1

There are 1 best solutions below

0
On

This error message...

Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.openqa.selenium.chrome.ChromeDriverService$Builder does not define or inherit an implementation of the resolved method 'abstract void loadSystemProperties()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder

...implies that a class didn't implement the proper methods from parent classes.

This situation arises due to version/dependency mismatch.


This usecase

In your pom.xml you have 2 different dependencies for the same task.

  • selenium-java:

    https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
          <version>4.10.0</version>
    </dependency>
    
  • selenium-server:

    https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>3.9.0</version>
    </dependency>
    

Solution

Remove any one of the dependency, you should be good to go.