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
  • 6

1 Answers1

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
  • 151,581
  • 34
  • 225
  • 281
  • 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