serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
723 stars 518 forks source link

Missing Class; org/openqa/selenium/interactions/internal/Locatable with 1.9.0-rc.3 #1144

Closed hypery2k closed 6 years ago

hypery2k commented 6 years ago

The latest 1.9 RC fails with the following exceptions:

java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/internal/Locatable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:688)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:380)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165)
at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:616)
at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:572)
at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:558)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:887)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:808)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:285)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:217)
at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:893)
at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:46)
at com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:50)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:134)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
at com.google.inject.Guice.createInjector(Guice.java:99)
at com.google.inject.Guice.createInjector(Guice.java:73)
at com.google.inject.Guice.createInjector(Guice.java:62)
at net.thucydides.core.guice.Injectors.getInjector(Injectors.java:16)
at net.serenitybdd.junit.runners.SerenityRunner.<init>(SerenityRunner.java:100)

The repo is here and a Jenkins sample here.

wakaleo commented 6 years ago

That looks like a dependency conflict with one of the Selenium libraries - what version of selenium are you using!

hypery2k commented 6 years ago

Not added any version of selenium. thought that's already included in Serenity Core. Isn't it?

wakaleo commented 6 years ago

It is indeed, that is odd then (I'm not seeing it here). I will take a look when I get a chance

hypery2k commented 6 years ago

thanks. If I can help anywhere or should test a snapshot, just give me a ping. Glad to help

wakaleo commented 6 years ago

The java.lang.NoClassDefFoundError is definitely a version conflict (not a missing class). For some reason, your project is pulling in selenium-api version 2.53.0, as opposed to the version 3.9.1 used by serenity and appearing in the serenity-core pom file.

The workaround is to declare the selenium libraries in your dependencies, e.g.

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.9.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-api</artifactId>
            <version>3.9.1</version>
            <scope>test</scope>
        </dependency>

But a cleaner solution would be to find the library that is overriding the Serenity dependencies and put an exclusion on them.

annayyagari commented 6 years ago

Hi, We are testing microservice app using Serenity-cucumber-RestAssured-Spring setup and it is non browser testing. And I see same error as above. Copying the stack trace here. Not really sure why it is looking for selenium. java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/internal/Locatable at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.getDeclaredMethods(Class.java:1975) at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:688) at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:380) at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165) at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:616) at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:572) at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:558) at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:887) at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:808) at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:285) at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:217) at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:893) at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:46) at com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:50) at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:134) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107) at com.google.inject.Guice.createInjector(Guice.java:99) at com.google.inject.Guice.createInjector(Guice.java:73) at com.google.inject.Guice.createInjector(Guice.java:62) at net.thucydides.core.guice.Injectors.getInjector(Injectors.java:16) at net.serenitybdd.cucumber.CucumberWithSerenity.environmentSpecifiedTags(CucumberWithSerenity.java:58) at net.serenitybdd.cucumber.CucumberWithSerenity.createRuntime(CucumberWithSerenity.java:52) at cucumber.api.junit.Cucumber.(Cucumber.java:77) at net.serenitybdd.cucumber.CucumberWithSerenity.(CucumberWithSerenity.java:38) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.internal.Locatable at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

My dependencies:

net.serenity-bdd serenity-core 1.9.3 test
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber</artifactId>
        <version>1.9.3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-spring</artifactId>
        <version>1.9.3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-rest-assured</artifactId>
        <version>1.9.3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>1.9.3</version>
        <scope>test</scope>
    </dependency>

Your help on this is really appreciated. Thanks

GeitRavi commented 6 years ago

Hi I am also getting same error java.lang.NoClassDefFoundError:org/openqa/selenium/interactions/internal/Locatable

to resolved above error, I specifically mention selenium version 3.9.1 in my POM file and now I am getting different error.

Running TestRunner SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/D:/mvn_repo/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/D:/mvn_repo/org/slf4j/slf4j-simple/1.6.1/slf4j-simple-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] 18:05:10.043 [main] DEBUG net.thucydides.core.util.PropertiesFileLocalPreferences - LOADING LOCAL PROPERTIES FROM D:\workspace\Latest_Develop\serenity.properties 18:05:10.074 [main] DEBUG net.thucydides.core.util.PropertiesFileLocalPreferences - environment=Test 18:05:10.074 [main] DEBUG net.thucydides.core.util.PropertiesFileLocalPreferences - serenity.project.name=Test Execution Report 18:05:10.074 [main] DEBUG net.thucydides.core.util.PropertiesFileLocalPreferences - serenity.requirement.types=feature Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.669 sec <<< FAILURE! - in TestRunner initializationError(TestRunner) Time elapsed: 0 sec <<< ERROR!

Earlier it is working fine (TestRunner) if it runs separately.

@RunWith(CucumberWithSerenity.class) @CucumberOptions(features = {"src/test/resources/feature/NameAndExtensionValidation.feature"}, glue = {"com.acceptancetest"}) public class TestRunner {

}

Your help on this is really appreciated. Thanks

hypery2k commented 6 years ago

Setting explicit selenium dependency solved by issue. Thanks

annayyagari commented 6 years ago

Thanks @hypery2k ! Explicitly adding selenium dependencies have solved the issue.

PrasadNutalapati commented 5 years ago

I added dependencies as per Wakaleo, now I am getting these enforcement errors (may be because I am having ChromeDriver.exe version 2.45 in my project which requires even higher than 3.9.1 Selenium ???)

Rule 0: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message: Failed while enforcing RequireUpperBoundDeps. The error(s) are [ Require upper bound dependencies error for org.seleniumhq.selenium:selenium-api:3.9.1 paths to dependency are: +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-api:3.9.1 and +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-java:3.141.59 +-org.seleniumhq.selenium:selenium-api:3.141.59 and +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-java:3.141.59 +-org.seleniumhq.selenium:selenium-chrome-driver:3.141.59 +-org.seleniumhq.selenium:selenium-api:3.141.59 and +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-java:3.141.59 +-org.seleniumhq.selenium:selenium-edge-driver:3.141.59 +-org.seleniumhq.selenium:selenium-api:3.141.59 and +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-java:3.141.59 +-org.seleniumhq.selenium:selenium-firefox-driver:3.141.59 +-org.seleniumhq.selenium:selenium-api:3.141.59 and +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-java:3.141.59 +-org.seleniumhq.selenium:selenium-ie-driver:3.141.59 +-org.seleniumhq.selenium:selenium-api:3.141.59 and +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-java:3.141.59 +-org.seleniumhq.selenium:selenium-opera-driver:3.141.59 +-org.seleniumhq.selenium:selenium-api:3.141.59 and +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-java:3.141.59 +-org.seleniumhq.selenium:selenium-remote-driver:3.141.59 +-org.seleniumhq.selenium:selenium-api:3.141.59 and +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-java:3.141.59 +-org.seleniumhq.selenium:selenium-safari-driver:3.141.59 +-org.seleniumhq.selenium:selenium-api:3.141.59 and +-com.company.qa.serenityjvm.datahubui:com.company.qa.serenity.datahubui:0.0.1-SNAPSHOT +-org.seleniumhq.selenium:selenium-java:3.141.59 +-org.seleniumhq.selenium:selenium-support:3.141.59 +-org.seleniumhq.selenium:selenium-api:3.141.59 ]

I updated the Selenium-Core and Selenium-api version dependency to 3.141.59, now the previous errors came again..

[ERROR] /Users/pnutala/intelliJ-workspace/com.company.qa.serenity.datahubui/src/main/java/pageobjects/DataHubPage.java:[7,27] package org.openqa.selenium does not exist [ERROR] /Users/pnutala/intelliJ-workspace/com.company.qa.serenity.datahubui/src/main/java/pageobjects/DataHubPage.java:[32,23] cannot access org.openqa.selenium.internal.WrapsElement [ERROR] class file for org.openqa.selenium.internal.WrapsElement not found [ERROR] /Users/pnutala/intelliJ-workspace/com.company.qa.serenity.datahubui/src/main/java/pageobjects/DataHubPage.java:[33,17] cannot access org.openqa.selenium.internal.Locatable [ERROR] class file for org.openqa.selenium.internal.Locatable not found

If I have to downgrade my ChromeDriver.exe to a lower version which will work with Selenium 3.9.1, which version it could be ?

PrasadNutalapati commented 5 years ago
My issue got resolved by adjusting the pom.xml file with proper versions in order to avoid redundancies. For reference I am giving my pom which is working.
<?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.company.qa.serenityjvm.datahubui</groupId>
  <artifactId>com.company.qa.serenity.datahubui</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>company Analytics Engineering DataHub UI Test Automation using Serenity project using Cucumber and WebDriver</name>

      <properties>
        <serenity.version>2.0.24</serenity.version>
        <serenity.maven.version>2.0.24</serenity.maven.version>
        <serenity.cucumber.version>1.9.21</serenity.cucumber.version>
        <serenity.report.resources.version>2.0.24</serenity.report.resources.version>
        <serenity.cucumber.archetype.version>1.8.4</serenity.cucumber.archetype.version>
        <serenity.junit.archetype.version>1.8.4</serenity.junit.archetype.version>
        <ngwebdriver.version>1.1.4</ngwebdriver.version>
        <assertj.version>3.5.1</assertj.version>
        <parallel.tests>1</parallel.tests>
        <webdriver.driver>chrome</webdriver.driver>
        <encoding>UTF-8</encoding>
    </properties>

    <dependencies>
    <dependency>
            <groupId>com.paulhammant</groupId>
            <artifactId>ngwebdriver</artifactId>
            <version>${ngwebdriver.version}</version>
            <!-- You might want to delete the following line if you get "package com.paulhammant.ngwebdriver does not exist" errors -->
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>[${serenity.version}]</version>
        </dependency>
         <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
                <scope>provided</scope>                
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-junit</artifactId>
            <version>[${serenity.version}]</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber</artifactId>
            <version>[${serenity.cucumber.version}]</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-report-resources</artifactId>
            <version>[${serenity.report.resources.version}]</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber-archetype</artifactId>
            <version>[${serenity.cucumber.archetype.version}]</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-junit-archetype</artifactId>
            <version>[${serenity.junit.archetype.version}]</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>[1.7.25,]</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
                    <includes>
                        <include>**/*Runner.java</include>                       
                    </includes>
                    <systemProperties>
                        <webdriver.driver>${webdriver.driver}</webdriver.driver>
                    </systemProperties>
                    <parallel>classes</parallel>
                    <threadCount>${parallel.tests}</threadCount>
                    <forkCount>${parallel.tests}</forkCount>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </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>
    </build>

</project>
sifulovi commented 5 years ago

My Dependencies are

buildscript { repositories { mavenLocal() jcenter() } dependencies { classpath("net.serenity-bdd:serenity-gradle-plugin:2.0.48") } }

apply plugin: 'net.serenity-bdd.aggregator'

dependencies { compile 'org.codehaus.groovy:groovy-all:2.3.11' testCompile group: 'junit', name: 'junit', version: '4.12' testCompile group: 'org.testng', name: 'testng', version: '6.11' implementation 'net.serenity-bdd:serenity-cucumber4:1.0.12' implementation 'net.serenity-bdd:serenity-core:2.0.48'

compile 'com.thedeanda:lorem:2.1'
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'

}

java.lang.NoClassDefFoundError: org/openqa/selenium/internal/WrapsElement

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at com.google.inject.spi.InjectionPoint.getDeclaredMethods(InjectionPoint.java:766)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:683)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:378)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:182)
at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:661)
at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:617)
at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:603)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:932)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:852)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:291)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:222)
at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:938)
at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:48)
at com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:60)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:133)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.inject.Guice.createInjector(Guice.java:59)
at net.thucydides.core.guice.Injectors.getInjector(Injectors.java:27)
at net.serenitybdd.core.di.WebDriverInjectors.getInjector(WebDriverInjectors.java:10)
at net.thucydides.core.webdriver.WebDriverFactory.<init>(WebDriverFactory.java:63)
at net.thucydides.core.webdriver.WebDriverFactory.<init>(WebDriverFactory.java:57)
at net.thucydides.core.webdriver.WebdriverProxyFactory.<init>(WebdriverProxyFactory.java:31)
at net.thucydides.core.webdriver.WebdriverProxyFactory.getFactory(WebdriverProxyFactory.java:37)
at net.thucydides.core.steps.BaseStepListener.<init>(BaseStepListener.java:235)
at net.thucydides.core.steps.BaseStepListener.<init>(BaseStepListener.java:231)
at net.thucydides.core.steps.Listeners$BaseStepListenerBuilder.withOutputDirectory(Listeners.java:37)
at net.serenitybdd.core.SerenityListeners.<init>(SerenityListeners.java:30)
at cucumber.runtime.formatter.SerenityReporter.initialiseThucydidesListenersFor(SerenityReporter.java:136)
at cucumber.runtime.formatter.SerenityReporter.lambda$handleTestSourceRead$8(SerenityReporter.java:186)
at java.util.Optional.ifPresent(Optional.java:159)
at cucumber.runtime.formatter.SerenityReporter.handleTestSourceRead(SerenityReporter.java:181)
at cucumber.runtime.formatter.SerenityReporter.lambda$new$0(SerenityReporter.java:140)
at cucumber.runner.AbstractEventPublisher.send(AbstractEventPublisher.java:45)
at cucumber.runner.AbstractEventBus.send(AbstractEventBus.java:9)
at cucumber.runner.TimeServiceEventBus.send(TimeServiceEventBus.java:3)
at cucumber.runtime.model.CucumberFeature.sendTestSourceRead(CucumberFeature.java:32)
at net.serenitybdd.cucumber.CucumberWithSerenity.<init>(CucumberWithSerenity.java:116)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.internal.WrapsElement at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 80 more

Poorva24 commented 4 years ago

I am facing same issue while working with serenity cucumber Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.internal.WrapsElement. I have added selenium dependencies but still not able to solve

wakaleo commented 4 years ago

Take a look at one of the starter projects to see the dependencies you need.

annnapurnabingi commented 2 years ago

Hi, some one please help me out through this issue. I am facing an issue with eclipse saying that no class def found error. The Pom.xml contains <?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">

4.0.0 Project Egifts 0.0.1-SNAPSHOT jar Egifts http://www.example.com UTF-8 1.8 1.8 org.seleniumhq.selenium selenium-java 4.3.0 org.testng testng 7.5 test io.github.bonigarcia webdrivermanager 5.2.0 org.seleniumhq.selenium selenium-chrome-driver 4.2.2 org.apache.poi poi 5.2.2 org.apache.maven.plugins maven-surefire-plugin 3.0.0-M5

and the error i am getting is

[RemoteTestNG] detected TestNG version 7.4.0 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. FAILED CONFIGURATION: @BeforeClass setUp java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/HasTouchScreen at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at Generics.BaseClass.setUp(BaseClass.java:29) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133) at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:62) at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:385) at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:321) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:176) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:122) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.testng.TestRunner.privateRun(TestRunner.java:794) at org.testng.TestRunner.run(TestRunner.java:596) at org.testng.SuiteRunner.runTest(SuiteRunner.java:377) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332) at org.testng.SuiteRunner.run(SuiteRunner.java:276) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212) at org.testng.TestNG.runSuitesLocally(TestNG.java:1134) at org.testng.TestNG.runSuites(TestNG.java:1063) at org.testng.TestNG.run(TestNG.java:1031) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.HasTouchScreen at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 43 more

SKIPPED CONFIGURATION: @AfterClass tearDown SKIPPED: Loginthourhsignup java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/HasTouchScreen at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at Generics.BaseClass.setUp(BaseClass.java:29) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133) at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:62) at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:385) at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:321) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:176) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:122) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.testng.TestRunner.privateRun(TestRunner.java:794) at org.testng.TestRunner.run(TestRunner.java:596) at org.testng.SuiteRunner.runTest(SuiteRunner.java:377) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332) at org.testng.SuiteRunner.run(SuiteRunner.java:276) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212) at org.testng.TestNG.runSuitesLocally(TestNG.java:1134) at org.testng.TestNG.runSuites(TestNG.java:1063) at org.testng.TestNG.run(TestNG.java:1031) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.interactions.HasTouchScreen at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 43 more

=============================================== Default test Tests run: 1, Failures: 0, Skips: 1 Configuration Failures: 1, Skips: 1

=============================================== Default suite Total tests run: 1, Passes: 0, Failures: 0, Skips: 1 Configuration Failures: 1, Skips: 1

wakaleo commented 2 years ago

Looks like you have a dependency conflict - it seems unrelated to Serenity though.