SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
29.73k stars 8.02k forks source link

[🐛 Bug]: Using selenium-devtools-v123 with chrome 124.0.6367.201 is throwing no such method error on createSession method #14161

Closed nidabaigg closed 1 week ago

nidabaigg commented 1 week ago

What happened?

I was previously using selenium-devtools-v119 but when I updated my chrome I was getting error to upgrade my devtools. When I upgraded my devtools to latest version I started getting error on createSession() method

How can we reproduce the issue?

In pom.xml add the following dependency: 
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-devtools-v123 -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-devtools-v123</artifactId>
    <version>4.21.0</version>
</dependency>

Then execute the following script:
ChromeDriver driver = (ChromeDriver) WebDriverRunner.getWebDriver();
        DevTools devTools = driver.getDevTools();
        devTools.createSession();

Relevant log output

[TestNG-test=Web test-1] INFO org.testng.internal.Utils - [Invoker 300690223] Keeping method BaseTest.tearDown()[pri:0, instance:com.rewaatech.platform.testcases.web.posV2.offline.Classic.C9883_ClassicRegisterOfflineModeSellSimpleProductBySimulatingTheScanningOfProductWithCreditCardPaymentTaxInclusiveSTI@d13baac] for class [TestClass name=class com.rewaatech.platform.testcases.web.posV2.offline.Classic.C9883_ClassicRegisterOfflineModeSellSimpleProductBySimulatingTheScanningOfProductWithCreditCardPaymentTaxInclusiveSTI]
[TestNG-test=Web test-1] INFO org.testng.internal.Utils - [Invoker 300690223] Invoking @AfterMethod BaseTest.tearDown()[pri:0, instance:com.rewaatech.platform.testcases.web.posV2.offline.Classic.C9883_ClassicRegisterOfflineModeSellSimpleProductBySimulatingTheScanningOfProductWithCreditCardPaymentTaxInclusiveSTI@d13baac]

java.lang.NoSuchMethodError: 'java.util.function.Function org.openqa.selenium.devtools.ConverterFunctions.map(java.lang.String, java.util.function.Function)'

Operating System

Ubuntu

Selenium version

Java 11.0.23

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

chrome 124.0.6367.201

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

chrome 124.0.6367.201

Are you using Selenium Grid?

no

github-actions[bot] commented 1 week ago

@nidabaigg, 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!

diemol commented 1 week ago

Did you upgrade Selenium as well or just DevTools?

nidabaigg commented 1 week ago

@diemol I've only upgraded my devtools

diemol commented 1 week ago

You should upload all Selenium dependencies

nidabaigg commented 1 week ago

@diemol here you go:

<dependency>
            <groupId>com.codeborne</groupId>
            <artifactId>selenide-appium</artifactId>
            <exclusions>
                <exclusion>
                    <!-- Added this to resolved java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMap -->
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-remote-driver</artifactId>
                </exclusion>
            </exclusions>
            <version>6.17.0</version>
        </dependency>
        <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-devtools-v123</artifactId>
    <version>4.21.0</version>
</dependency>       
<dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>4.11.0</version>
        </dependency>
<dependency>
            <groupId>net.itarray</groupId>
            <artifactId>automotion</artifactId>
            <version>3.0.0</version>
            <scope>system</scope>
            <systemPath>${pom.basedir}/src/main/resources/automotion-3.0.0-jar-with-dependencies.jar</systemPath>
            <exclusions>
                <exclusion>
                    <!-- Added this to resolved java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMap -->
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-server</artifactId>
                </exclusion>
                <exclusion>
                    <!-- Added this to resolved java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMap -->
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-remote-driver</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
diemol commented 1 week ago

You are using a mix of different versions. Selenide's latest is 7.3.1, and Selenium is 4.21.0.

I believe if you use the latest Selenide, you will get the latest Selenium. Avoid mixing versions like that.

titusfortner commented 1 week ago

speaking of selenide, from the project lead: https://www.javaadvent.com/2020/12/how-to-debug-dependency-conflicts-in-maven-and-gradle.html