1

I did not have problem to run this before becoming messy with something.

Any help would be appciated.

I am getting this error chrome driver when running any test class with chrome driver.

I tried to put chrome driver options, but still not working. I upgraded chrome driver version and some other frameworks, but still same error.

@RunWith(Cucumber.class)
@CucumberOptions(features="src/test/Features", glue= {"StepDefinitions"},
monochrome = true,

plugin = {"pretty", "junit:target/junit/report.xml",
        "html:target/html/HtmlReports",
        "json:target/JSONReports/report.json"},
tags="@Sorting_HL"
    

> java.lang.AbstractMethodError: Receiver class
> org.openqa.selenium.chrome.ChromeDriverService$Builder does not define
> or inherit an implementation of the resolved method 'abstract
> java.util.List createArgs()' of abstract class
> org.openqa.selenium.remote.service.DriverService$Builder.     at
> org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:441)
>   at
> org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)
>   at
> org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
>   at
> StepDefinitions.COB_sorting_2.sorting_tab_is_seen(COB_sorting_2.java:57)
>   at ✽.Sorting tab is seen.(file:///folder/src/test/Features/sorting.feature:50)

class

@Given("Sorting tab is seen.")
    public void sorting_tab_is_seen() throws IOException {

        System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
        String url = "url address";
        ChromeOptions chromeOptions = new ChromeOptions();
        
//      chromeOptions.addArguments("--headless"); 
    //  chromeOptions.addArguments("no-sandbox");
        driver= new ChromeDriver(chromeOptions);

        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.manage().window().maximize();
        driver.get(url);
    }

If I add headless on options, they say

java.lang.NoSuchMethodError: 'org.openqa.selenium.chromium.ChromiumOptions org.openqa.selenium.chrome.ChromeOptions.addArguments(java.lang.String[])'
at StepDefinitions.COB_sorting_2.sorting_tab_is_seen(COB_sorting_2.java:55)
at ✽.Sorting tab is seen.(file:///folder/src/test/Features/sorting.feature:50)

pom xml

<?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>com.eCommerce</groupId>
    <artifactId>mavenProject</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <name>mavenProject</name>
    <!-- FIXME change it to the project's website -->
    <url>http://www.example.com</url>

    <properties>

        <suiteXmlFile>src/main/testng.xml</suiteXmlFile>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/log4j/log4j -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
            <scope>compile</scope>
        </dependency>

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

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.4.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>7.0.0</version>
            <scope>compile</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>7.0.0</version>
            <scope>compile</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>6.11.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.masterthought/maven-cucumber-reporting -->
        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>5.3.0</version>
        </dependency>
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>8.0.0-beta</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>7.1.0</version>
        </dependency>
        
    </dependencies>

    <build>
        <!-- <pluginManagement> lock down plugins versions to avoid using Maven 
                defaults (may be moved to parent pom)
                </pluginManagement>
                 -->
            <plugins>
                <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.0</version>
                    <configuration>
                        <!-- 
                        <suiteXmlFiles>
                            <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
                        </suiteXmlFiles>
                         -->
                        <testFailureIgnore>true</testFailureIgnore>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.7.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <!-- 
                <plugin>
                    <groupId>net.masterthought</groupId>
                    <artifactId>maven-cucumber-reporting</artifactId>
                    <version>2.8.0</version>
                    <executions>
                        <execution>
                            <id>execution</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                            <configuration>
                                <projectName>mavenProject</projectName>
                                <outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
                                <cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                 -->
            </plugins>


    </build>
</project>

Your help would be appreciated. Thanks,

Workhard
  • 43
  • 2
  • 7

2 Answers2

0

You need to pass the absolute path of the ChromeDriver executable through the System.setProperty() line as follows:

System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thank you for your answer. The driver file was located in the project, but I tried it by locating that path and still same message error. Should I make a new porject? – Workhard Jan 03 '22 at 18:05
  • @Workhard Yup, try with a new project and keep me updated – undetected Selenium Jan 03 '22 at 18:06
  • @Debanjan8 yeah chrome driver works in a new project. (I have to move files/codes to the new project ahhhh..) I think the above prject has something wrong or incompability with something. I messed up from github. Is this inpossible to fix? Thanks, – Workhard Jan 03 '22 at 19:20
0

Yesterday even i faced the same where my Test script all of a sudden stopped working, after the Build generation process. I did tremendous research behind it, But found nothing. As per the stack trace the error says "AppiumServiceBuilder does not define or inherit an implementation of the resolved method 'abstract void loadSystemProperties()' of abstract class org.openqa.selenium.remote.service.DriverService$Builder" Wherein the AppiumServiceBuilder the subclass of DriverService class does not override/implement its abstract method. We spend the entire day referring to this. Fortuantely one of the Java Developer unpacked the "appium client" jar file to see for the appropriate Selenium version reference(main.properties file). And as an IDE we were using IntelliJ idea, we checked for the project structure. And we found out that some of the dependent Jar files of selenium refers to latest version of Selenium. For which we manually added the appropriate version dependencies. And our issue was resolved.

"In A Nutt shell" - Appium client was referring to a dependency for which it didnt get the implementation of the abstract method. As dependency related to selenium was getting resolved from a different version. Due to which it was failing all of a sudden. We fixed the selenium dependency to the correct version and it started working.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 26 '23 at 10:31