selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🐛 Bug]: Upgrade to 4.17.0 throws error during driver register

Open annapoorni opened this issue 1 year ago • 3 comments

What happened?

When using driver register method , error -> java.lang.NoSuchMethodError: 'java.util.function.Function org.openqa.selenium.devtools.ConverterFunctions.map

Context: Upgrading selenium form 4.12.0 to 4.17.0 as it has support for chrome version 121.

How can we reproduce the issue?

ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.addArguments("--disable-web-security");
        chromeOptions.addArguments("--allow-running-insecure-content");
        chromeOptions.addArguments("--remote-allow-origins=*");
        chromeOptions.addArguments("incognito");
ChromeDriver driver = new ChromeDriver(chromeOptions);
 driver.register(UsernameAndPassword.of("sample", "sample"));

Relevant log output

Stacktrace:
        java.lang.NoSuchMethodError: 'java.util.function.Function org.openqa.selenium.devtools.ConverterFunctions.map(java.lang.String, java.util.function.Function)'
        at org.openqa.selenium.devtools.v121.target.Target.getTargets(Target.java:153)
        at org.openqa.selenium.devtools.v121.v121Target.getTargets(v121Target.java:55)
        at org.openqa.selenium.devtools.DevTools.findTarget(DevTools.java:145)
        at org.openqa.selenium.devtools.DevTools.createSession(DevTools.java:114)
        at org.openqa.selenium.devtools.DevTools.createSessionIfThereIsNotOne(DevTools.java:97)
        at org.openqa.selenium.chromium.ChromiumDriver.register(ChromiumDriver.java:167)
        at org.openqa.selenium.HasAuthentication.register(HasAuthentication.java:49)

snip of pom.xml

<properties>
    <java.version>17</java.version>
    <spring.boot.version>3.0.7</spring.boot.version>
    <log4j.version>2.17.2</log4j.version>
    <lombok.version>1.18.22</lombok.version>
    <commonsio.version>2.11.0</commonsio.version>
    <commonslang.version>3.12.0</commonslang.version>
    <cucumber.version>6.10.4</cucumber.version>
    <junit.version>4.13.2</junit.version>
    <masterthought.version>5.5.0</masterthought.version>
    <selenium.version>4.17.0</selenium.version>
    <jackson.version>2.15.2</jackson.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <test.parallel.thread>1</test.parallel.thread>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>${spring.boot.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
    </dependency>

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.solace.spring.boot</groupId>
        <artifactId>solace-jms-spring-boot-starter</artifactId>
        <version>5.0.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
            <exclusion>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

  
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>${log4j.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${log4j.version}</version>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commonsio.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${commonslang.version}</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-yaml</artifactId>
        <version>${jackson.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-core</artifactId>
        <version>${cucumber.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${cucumber.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-spring</artifactId>
        <version>${cucumber.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${selenium.version}</version>
        <scope>test</scope>
       
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.2</version>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
                <parallel>methods</parallel>
                <threadCount>${test.parallel.thread}</threadCount>
                <perCoreThreadCount>false</perCoreThreadCount>
                <argLine>-Xmx1024m</argLine>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>${masterthought.version}</version>
            <executions>
                <execution>
                    <id>execution</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <projectName>${project.artifactId}</projectName>
                        <skip>false</skip>
                        <outputDirectory>${project.build.directory}</outputDirectory>
                        <inputDirectory>${project.build.directory}/reports</inputDirectory>
                        <jsonFiles>
                            <param>**/*.json</param>
                        </jsonFiles>
                        <mergeFeaturesById>false</mergeFeaturesById>
                        <mergeFeaturesWithRetest>false</mergeFeaturesWithRetest>
                        <checkBuildResult>false</checkBuildResult>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Operating System

Windows 10 Enterprise

Selenium version

4.17.0

What are the browser(s) and version(s) where you see this issue?

Chrome Browser version 121.0.6167.86

What are the browser driver(s) and version(s) where you see this issue?

Chrome Driver version 121.0.6167.85

Are you using Selenium Grid?

No

annapoorni avatar Feb 15 '24 23:02 annapoorni

@annapoorni, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] avatar Feb 15 '24 23:02 github-actions[bot]

In our example repo, I tried running the example for the same and could not reproduce the error. If you are running in an IDE, please invalidate caches and try.

pujagani avatar Feb 16 '24 04:02 pujagani

We need more information about this issue in order to troubleshoot.

Please turn on logging and re-run your code. Information on how to adjust logs for your language can be found in our Troubleshooting documentation.

github-actions[bot] avatar Feb 16 '24 15:02 github-actions[bot]

This is the dependency issue as Spring pulls 4.5.3 version. We were able to resolve this by explicitly adding the dependencies along with selenium-java like following. pom.xml

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${selenium.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-remote-driver</artifactId>
        <version>${selenium.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-api</artifactId>
        <version>${selenium.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-http</artifactId>
        <version>${selenium.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-json</artifactId>
        <version>${selenium.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-support</artifactId>
        <version>${selenium.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
        <version>${selenium.version}</version>
        <scope>test</scope>
    </dependency>

annapoorni avatar Feb 19 '24 03:02 annapoorni

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Mar 21 '24 00:03 github-actions[bot]