6 Replies Latest reply on Aug 28, 2013 4:01 PM by felipe.gdr

    Cannot get Arquillian + Drone + Graphene to work (ClassNotFoundException: org.openqa.selenium.WebDriver)

    felipe.gdr

      I keep getting ClassNotFoundException: org.openqa.selenium.WebDriver when running my test.

       

      I have these BOM imports in my pom.xml

        <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-bom</artifactId>
        <version>>1.2.0.Alpha2</version>
        <type>pom</type>
        <scope>import</scope>
        </dependency>
        <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>${version.arquillian.bom}</version>
        <scope>import</scope>
        <type>pom</type>
        </dependency>
      


      also I have this graphene dependency:

      
      
        <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver</artifactId>
        <version>2.0.0.Alpha4</version>
        <type>pom</type>
        <scope>test</scope>
        </dependency>
      


      My test has this injection:

      
      
       @Drone
      private WebDriver navegador;
      
        • 1. Re: Cannot get Arquillian + Drone + Graphene to work (ClassNotFoundException: org.openqa.selenium.WebDriver)
          kpiwko

          Hello Felipe,

           

          I guess that BOM imports are in <dependencyManagement> section, while graphene-webdriver is in <dependency> section? Is so, the other tip is:

           

          are you running your tests as client - e.g. either deployment is marked via @Deployment(testable=false) or you use @RunAsClient annotation on test method. WebDriver class is indeed not transferred to the server in case your running "in container" mode, which is the default.

           

          HTH,

           

          Karel

          • 2. Re: Cannot get Arquillian + Drone + Graphene to work (ClassNotFoundException: org.openqa.selenium.WebDriver)
            felipe.gdr

            Hi Karel, thanks for your answer!

             

            Yes, the BOM imports are in the dependencyManagement section and graphene-webdriver is in dependency section. And yes, I'm using @Deployment(testable=false) on my deployment method, I have also tried using @Deployment(testable=true) with @RunAsClient on my test method, but neither worked.

            • 3. Re: Cannot get Arquillian + Drone + Graphene to work (ClassNotFoundException: org.openqa.selenium.WebDriver)
              kpiwko

              Can you post/attach/gist/pastebin full pom.xml/stacktrace?

              • 4. Re: Re: Cannot get Arquillian + Drone + Graphene to work (ClassNotFoundException: org.openqa.selenium.WebDriver)
                felipe.gdr

                I'm getting a little lost here...Now I'm getting a "Non-resolvable import POM" on the drone BOM dependency, if I remove the <scope> from this dependency the error goes away, but then it complains that the drone dependencies don't have the <version> declared.

                 

                My complete POM is the following:

                 

                 

                - root pom:

                <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>
                ....
                
                 <modules>
                ....
                 </modules>
                
                 <dependencies>
                  <dependency>
                 .....
                 </dependencies>
                
                 <dependencyManagement>
                  <dependencies>    
                  <dependency>
                  <groupId>org.jboss.arquillian</groupId>
                  <artifactId>arquillian-bom</artifactId>
                  <version>1.0.0.Final</version>
                  <scope>import</scope>
                  <type>pom</type>
                  </dependency> 
                  </dependencies>
                 </dependencyManagement>
                
                 <build>
                  <plugins>
                  <plugin>
                  <groupId>org.jacoco</groupId>
                  <artifactId>jacoco-maven-plugin</artifactId>
                  <version>${version.jacoco}</version>
                  <executions>
                  <execution>
                  <id>prepare-agent</id>
                  <goals>
                  <goal>prepare-agent</goal>
                  </goals>
                  </execution>
                  <execution>
                  <id>report</id>
                  <phase>prepare-package</phase>
                  <goals>
                  <goal>report</goal>
                  </goals>
                  </execution>
                  </executions>
                  </plugin>
                  <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>3.0</version>
                  <configuration>
                  <source>1.7</source>
                  <target>1.7</target>
                  <encoding>UTF-8</encoding>
                  </configuration>
                  </plugin>
                  <plugin>
                  <groupId>com.atlassian.maven.plugins</groupId>
                  <artifactId>maven-jgitflow-plugin</artifactId>
                  <version>1.0-alpha14</version>
                  <configuration>
                  <enableFeatureVersions>true</enableFeatureVersions>
                  <autoVersionSubmodules>true</autoVersionSubmodules>
                  <pushReleases>true</pushReleases>
                  </configuration>
                  </plugin>
                  </plugins>
                 </build>
                
                 <profiles>
                  <profile>
                  <id>arquillian-jbossas-managed</id>
                  <activation>
                  <activeByDefault>true</activeByDefault>
                  </activation>
                  <build>
                  <plugins>
                  <plugin>
                  <artifactId>maven-dependency-plugin</artifactId>
                  <executions>
                  <execution>
                  <id>unpack</id>
                  <phase>process-test-classes</phase>
                  <goals>
                  <goal>unpack</goal>
                  </goals>
                  <configuration>
                  <artifactItems>
                  <artifactItem>
                  <groupId>org.jboss.as</groupId>
                  <artifactId>jboss-as-dist</artifactId>
                  <version>7.1.1.Final</version>
                  <type>zip</type>
                  <overWrite>false</overWrite>
                  <outputDirectory>target</outputDirectory>
                  </artifactItem>
                  </artifactItems>
                  </configuration>
                  </execution>
                  </executions>
                  </plugin>
                  </plugins>
                  <pluginManagement>
                  <plugins>
                  <!-- Ignore/Execute plugin execution -->
                  <plugin>
                  <groupId>org.eclipse.m2e</groupId>
                  <artifactId>lifecycle-mapping</artifactId>
                  <version>1.0.0</version>
                  <configuration>
                  <lifecycleMappingMetadata>
                  <pluginExecutions>
                  <!-- copy-dependency plugin -->
                  <pluginExecution>
                  <pluginExecutionFilter>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-dependency-plugin</artifactId>
                  <versionRange>[1.0.0,)</versionRange>
                  <goals>
                  <goal>unpack</goal>
                  </goals>
                  </pluginExecutionFilter>
                  <action>
                  <execute />
                  </action>
                  </pluginExecution>
                  </pluginExecutions>
                  </lifecycleMappingMetadata>
                  </configuration>
                  </plugin>
                  </plugins>
                  </pluginManagement>
                  <testResources>
                  <testResource>
                  <directory>src/test/resources</directory>
                  </testResource>
                  </testResources>
                  </build>
                  <dependencies>
                  <dependency>
                  <groupId>org.jboss.as</groupId>
                  <artifactId>jboss-as-arquillian-container-managed</artifactId>
                  <version>7.1.1.Final</version>
                  <scope>test</scope>
                  <exclusions>
                  <exclusion>
                  <groupId>com.google.collections</groupId>
                  <artifactId>google-collections</artifactId>
                  </exclusion>
                  </exclusions>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.arquillian.protocol</groupId>
                  <artifactId>arquillian-protocol-servlet</artifactId>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.arquillian.extension</groupId>
                  <artifactId>arquillian-jacoco</artifactId>
                  <scope>test</scope>
                  <version>${version.arquillian.jacoco}</version>
                  </dependency>
                  <dependency>
                  <groupId>org.jacoco</groupId>
                  <artifactId>org.jacoco.core</artifactId>
                  <version>${version.jacoco}</version>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.arquillian.junit</groupId>
                  <artifactId>arquillian-junit-container</artifactId>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.arquillian.junit</groupId>
                  <artifactId>arquillian-junit-container</artifactId>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.arquillian.extension</groupId>
                  <artifactId>arquillian-persistence-impl</artifactId>
                  <version>${version.arquillian.persistence}</version>
                  <scope>test</scope>
                  </dependency>
                  </dependencies>
                  </profile>
                 </profiles>
                </project>
                



                And this is the pom from the module I want to test:


                
                
                <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>
                 <parent>
                ... parent
                 </parent>
                
                 <properties>
                  <version.jboss.servlet-3.0>1.0.2.Final</version.jboss.servlet-3.0>
                  <version.jboss.el-2.2>1.0.2.Final</version.jboss.el-2.2>
                  <version.jboss.jsf-2.2>2.2.0</version.jboss.jsf-2.2>
                  <version.commons.fileupload>1.2.2</version.commons.fileupload>
                  <version.commons.io>2.4</version.commons.io>
                  <version.commons.configuration>1.9</version.commons.configuration>
                  <version.atmosphere>1.0.8</version.atmosphere>
                  <version.primefaces.ext>0.7.1</version.primefaces.ext>
                  <version.primefaces>3.5.12</version.primefaces>
                  <version.easygloss>1.3</version.easygloss>
                 </properties>
                
                 <dependencyManagement>
                  <dependencies>
                  <dependency>
                  <groupId>org.jboss.arquillian.extension</groupId>
                  <artifactId>arquillian-drone-bom</artifactId>
                  <version>>1.0.0.Final</version>
                  <type>pom</type>
                  <scope>import</scope>
                  </dependency>
                  </dependencies>
                
                 </dependencyManagement>
                
                 <dependencies>
                  <dependency>
                  <groupId>br.com.glr.populisII</groupId>
                  <artifactId>populis-apontador-ejb</artifactId>
                  <type>ejb</type>
                  <version>${project.parent.version}</version>
                  <scope>provided</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.spec.javax.servlet</groupId>
                  <artifactId>jboss-servlet-api_3.0_spec</artifactId>
                  <version>${version.jboss.servlet-3.0}</version>
                  <scope>provided</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.spec.javax.faces</groupId>
                  <artifactId>jboss-jsf-api_2.2_spec</artifactId>
                  <version>${version.jboss.jsf-2.2}</version>
                  <scope>provided</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.spec.javax.el</groupId>
                  <artifactId>jboss-el-api_2.2_spec</artifactId>
                  <version>${version.jboss.el-2.2}</version>
                  <scope>provided</scope>
                  </dependency>
                
                  <dependency>
                  <groupId>commons-fileupload</groupId>
                  <artifactId>commons-fileupload</artifactId>
                  <version>${version.commons.fileupload}</version>
                  </dependency>
                
                  <dependency>
                  <groupId>commons-io</groupId>
                  <artifactId>commons-io</artifactId>
                  <version>${version.commons.io}</version>
                  </dependency>
                
                  <dependency>
                  <groupId>org.atmosphere</groupId>
                  <artifactId>atmosphere-runtime</artifactId>
                  <version>${version.atmosphere}</version>
                  </dependency>
                
                  <dependency>
                  <groupId>org.primefaces.extensions</groupId>
                  <artifactId>primefaces-extensions</artifactId>
                  <version>${version.primefaces.ext}</version>
                  <exclusions>
                  <exclusion>
                  <groupId>org.primefaces</groupId>
                  <artifactId>primefaces</artifactId>
                  </exclusion>
                  </exclusions>
                  </dependency>
                  <dependency>
                  <groupId>org.primefaces</groupId>
                  <artifactId>primefaces</artifactId>
                  <version>${version.primefaces}</version>
                  </dependency>
                  <dependency>
                  <groupId>commons-configuration</groupId>
                  <artifactId>commons-configuration</artifactId>
                  <version>${version.commons.configuration}</version>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.shrinkwrap.resolver</groupId>
                  <artifactId>shrinkwrap-resolver-api-maven</artifactId>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.shrinkwrap.resolver</groupId>
                  <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.arquillian.extension</groupId>
                  <artifactId>arquillian-drone-impl</artifactId>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.arquillian.extension</groupId>
                  <artifactId>arquillian-drone-selenium</artifactId>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.jboss.arquillian.extension</groupId>
                  <artifactId>arquillian-drone-selenium-server</artifactId>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.seleniumhq.selenium</groupId>
                  <artifactId>selenium-java</artifactId>
                  <scope>test</scope>
                  </dependency>
                  <dependency>
                  <groupId>org.seleniumhq.selenium</groupId>
                  <artifactId>selenium-server</artifactId>
                  <scope>test</scope>
                  <exclusions>
                  <exclusion>
                  <groupId>org.mortbay.jetty</groupId>
                  <artifactId>servlet-api-2.5</artifactId>
                  </exclusion>
                  </exclusions>
                  </dependency>
                  <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-simple</artifactId>
                  <version>1.6.4</version>
                  <scope>test</scope>
                  </dependency>
                 </dependencies>
                
                 <build>
                  <pluginManagement>
                  <plugins>
                  <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-war-plugin</artifactId>
                  <version>2.1.1</version>
                  <configuration>
                  <archive>
                  <manifest>
                  <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                  <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                  </manifest>
                  </archive>
                  </configuration>
                  </plugin>
                  </plugins>
                  </pluginManagement>
                 </build>
                </project>
                
                • 5. Re: Re: Re: Cannot get Arquillian + Drone + Graphene to work (ClassNotFoundException: org.openqa.selenium.WebDriver)
                  kpiwko

                  I think I see the problem. The old version didn't have depchains. Steps to fix that:

                   

                  1/ Update Arquillian Core (1.1.1.Final) and Arquillian Drone versions (1.2.0.Alpha3 or 1.2.0.Beta1 - will be available tomorrow, provides support for Firefox 22 and newer)

                  2/ In your test pom, replace all org.jboss.shrinkwrap.resolver artifacts with a depchain:

                   

                    <dependency>
                      <groupId>org.jboss.shrinkwrap.resolver</groupId>
                      <artifactId>shrinkwrap-resolver-depchain</artifactId>
                      <scope>test</scope>
                      <type>pom</type>
                    </dependency>
                  
                  
                  
                  

                   

                  3/ You want to use WebDriver, not Selenium1 (DefaultSelenium). Replace all Drone artifacts with a depchain:

                   

                  <dependency>
                      <groupId>org.jboss.arquillian.extension</groupId>
                      <artifactId>arquillian-drone-webdriver-depchain</artifactId>
                      <scope>test</scope>
                      <type>pom</type>
                  </dependency>
                  
                  
                  
                  

                   

                  Alternatively, you can use Graphene2 depchain instead as you mentioned in the first post. Version would be 1.2.0.Alpha3 for Drone and 2.0.0.Alpha4 for Graphene2.

                   

                  4/ Remove all Selenium, servlet-api and slf4j deps. There are either no longer needed or already incorporated in Drone depchain.

                   

                  That should make it work.

                   

                  Karel

                  1 of 1 people found this helpful
                  • 6. Re: Re: Cannot get Arquillian + Drone + Graphene to work (ClassNotFoundException: org.openqa.selenium.WebDriver)
                    felipe.gdr

                    Thank you for your help Karel. Now everything is working!