Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError: org/openqa/selenium/devtools/DevTools #2664

Closed
cmccarthyIrl opened this issue Jan 14, 2022 · 3 comments
Closed

NoClassDefFoundError: org/openqa/selenium/devtools/DevTools #2664

cmccarthyIrl opened this issue Jan 14, 2022 · 3 comments

Comments

@cmccarthyIrl
Copy link

cmccarthyIrl commented Jan 14, 2022

Hi,

I'm having some trouble executing my tests using the following version of Serenity and SpringBoot. I'm getting the error
NoClassDefFoundError: org/openqa/selenium/devtools/DevTools

Repo : https://github.com/cmccarthyIrl/spring-cucumber-serenity-test-harness/tree/feature/devtools

POM

`
spring-boot-starter-parent
org.springframework.boot
2.3.3.RELEASE

<modules>
    <module>common</module>
    <module>wikipedia</module>
    <module>weather</module>
</modules>

<properties>
    <activeProfile>prod</activeProfile>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <serenity.version>3.1.13</serenity.version>
    <encoding>UTF-8</encoding>
    <tags></tags>
    <webdriver.base.url></webdriver.base.url>
</properties>
<dependencies>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>7.2.2</version>
    </dependency>
    <dependency>
        <artifactId>spring-boot-starter-test</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>android-json</artifactId>
                <groupId>com.vaadin.external.google</groupId>
            </exclusion>
        </exclusions>
        <groupId>org.springframework.boot</groupId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <artifactId>spring-test</artifactId>
        <groupId>org.springframework</groupId>
    </dependency>
    <dependency>
        <artifactId>spring-rabbit</artifactId>
        <groupId>org.springframework.amqp</groupId>
        <version>2.2.11.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.10</version>
    </dependency>
    <!--        Serenity Code-->
    <!--        Serenity Code-->
    <!--        Serenity Code-->


    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>3.1.15</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-screenplay</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-screenplay-rest</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-screenplay-webdriver</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-ensure</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber</artifactId>
        <version>3.1.13</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-rest-assured</artifactId>
        <version>2.2.12</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-spring</artifactId>
        <version>3.1.13</version>
    </dependency>
    <dependency>
        <artifactId>commons-io</artifactId>
        <groupId>commons-io</groupId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.13.1</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.13.1</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.13.1</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.6.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <artifactId>rest-assured</artifactId>
        <groupId>io.rest-assured</groupId>
        <version>3.3.0</version>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
                <groupId>org.apache.maven.plugins</groupId>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <version>2.19.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>${serenity.maven.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>net.serenity-bdd</groupId>
                        <artifactId>serenity-core</artifactId>
                        <version>${serenity.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>serenity-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

`
Stacktrace :

Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/devtools/DevTools at java.base/java.lang.Class.getDeclaredMethods0(Native Method) at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166) at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309) at com.google.common.eventbus.SubscriberRegistry.getAnnotatedMethodsNotCached(SubscriberRegistry.java:180) at com.google.common.eventbus.SubscriberRegistry.access$000(SubscriberRegistry.java:54) at com.google.common.eventbus.SubscriberRegistry$1.load(SubscriberRegistry.java:154) at com.google.common.eventbus.SubscriberRegistry$1.load(SubscriberRegistry.java:151) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2156) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2046) at com.google.common.cache.LocalCache.get(LocalCache.java:3948) at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3972) at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4957) at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4963) at com.google.common.eventbus.SubscriberRegistry.getAnnotatedMethods(SubscriberRegistry.java:173) at com.google.common.eventbus.SubscriberRegistry.findAllSubscribers(SubscriberRegistry.java:164) at com.google.common.eventbus.SubscriberRegistry.register(SubscriberRegistry.java:74) at com.google.common.eventbus.EventBus.register(EventBus.java:186) at net.serenitybdd.screenplay.abilities.BrowseTheWeb.registerForEventNotification(BrowseTheWeb.java:38) at net.serenitybdd.screenplay.abilities.BrowseTheWeb.<init>(BrowseTheWeb.java:34) at net.serenitybdd.screenplay.abilities.BrowseTheWeb.with(BrowseTheWeb.java:48) at net.serenitybdd.screenplay.actors.OnlineCast.actorNamed(OnlineCast.java:41) at net.serenitybdd.screenplay.actors.Stage.lambda$shineSpotlightOn$1(Stage.java:31) at java.base/java.util.Optional.orElseGet(Optional.java:369) at net.serenitybdd.screenplay.actors.Stage.shineSpotlightOn(Stage.java:31) at net.serenitybdd.screenplay.actors.OnStage.theActorCalled(OnStage.java:67) at com.cmccarthy.api.utils.Hooks.actor(Hooks.java:21) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.cucumber.java.Invoker.doInvoke(Invoker.java:66) at io.cucumber.java.Invoker.invoke(Invoker.java:24) at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47) at io.cucumber.java.JavaParameterTypeDefinition.execute(JavaParameterTypeDefinition.java:68) at io.cucumber.cucumberexpressions.ParameterType.transform(ParameterType.java:259) at io.cucumber.cucumberexpressions.Argument.getValue(Argument.java:42) at io.cucumber.core.stepexpression.ExpressionArgument.getValue(ExpressionArgument.java:17) at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:47) at io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10) at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:86) at io.cucumber.core.runner.TestStep.run(TestStep.java:57) at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:51) at io.cucumber.core.runner.TestCase.run(TestCase.java:95) at io.cucumber.core.runner.Runner.runPickle(Runner.java:75) at io.cucumber.junit.PickleRunners$NoStepDescriptions.lambda$run$0(PickleRunners.java:151) at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$3(CucumberExecutionContext.java:146) at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23) at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:146) at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:148) at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:144) at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:28) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at io.cucumber.junit.FeatureRunner.run(FeatureRunner.java:137) at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:259) at io.cucumber.junit.CucumberSerenityRunner.runChild(CucumberSerenityRunner.java:58) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at io.cucumber.junit.CucumberSerenityRunner$RunCucumber.evaluate(CucumberSerenityRunner.java:287) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.devtools.DevTools at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 78 more

@cmccarthyIrl cmccarthyIrl changed the title Serenity Screenplay - NoClassDefFoundError: org/openqa/selenium/devtools/DevTools NoClassDefFoundError: org/openqa/selenium/devtools/DevTools Jan 14, 2022
@wakaleo
Copy link
Member

wakaleo commented Jan 20, 2022

NoClassDefFoundError is a dependency conflict. Do a dependency analysis and identify and resolve the conflicts, and the error will go away.

@wakaleo
Copy link
Member

wakaleo commented Jan 22, 2022

Your project is pulling in Selenium 3, whereas Serenity (and DevTools) needs Selenium 4. You will need to resolve the conflicts in your pom file to use Selenium 4.

@cmccarthyIrl
Copy link
Author

Thanks @wakaleo !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants