0

I have added latest selenium version 4.10.0 in the automation test code.

Below is the pom.xml file of parent project:

<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.rc.alm</groupId>
    <artifactId>automated-acceptance-tests</artifactId>
    <version>1.0.113-SNAPSHOT</version>
    <packaging>pom</packaging>

    <name>Automated tests for Jira configuration</name>
    <url>https://misalm.rockwellcollins.com/wiki/display/ALMDEVW</url>

    <modules>
        <module>automated-acceptance-tests-services</module>
        <module>automated-acceptance-tests-suites</module>
    </modules>

    <properties>
        <alm.scm.git.url>https://misalm.rockwellcollins.com/git</alm.scm.git.url>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <log4j-version>2.10.0</log4j-version>
        <aspectj-version>1.8.13</aspectj-version>
        <javadoc.version>2.9.1</javadoc.version>
        <maven.javadoc.failOnError>false</maven.javadoc.failOnError>
    </properties>

    <dependencyManagement>
        <dependencies>
        
            <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>org.aspectj</groupId>
                <artifactId>aspectjrt</artifactId>
                <version>${aspectj-version}</version>
            </dependency>

            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjweaver</artifactId>
                <version>${aspectj-version}</version>
            </dependency>
            
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.14.0</version>
                <configuration>
                    <complianceLevel>11</complianceLevel>
                    <source>11</source>
                    <target>11</target>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.10</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>com.rc.alm.it.tests.suites.RunSuite</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
            </plugin>

        </plugins>
        <!-- A way to get rid of the pom error related to "Plugin execution not 
            covered by lifecycle" error -->
        <pluginManagement>
            <plugins>
            
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.3</version>
                    <configuration>
                        <checkModificationExcludes>
                            <checkModificationExclude>build-number.txt</checkModificationExclude>
                        </checkModificationExcludes>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${javadoc.version}</version>
                    <configuration>
                        <failOnError>${maven.javadoc.failOnError}</failOnError>
                        <quiet>true</quiet>
                        <show>public</show>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>aspectj-maven-plugin</artifactId>
                                        <versionRange>[1.14,)</versionRange>
                                        <goals>
                                            <goal>test-compile</goal>
                                            <goal>compile</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
                
            </plugins>
        </pluginManagement>
    </build>

    <distributionManagement>
        <!-- Security to these repositories is granted by our team's Maven settings 
            file: $M2_HOME/conf/settings.xml The repositories are given write access 
            via our project service account, xgsa0002 (http://alm.rockwellcollins.com/wiki/x/WAG9Bg). 
            Account credentials are tied to repository ID (nexus). -->
        <repository>
            <id>nexus</id>
            <name>ALM Maven Repository</name>
            <url>https://misnexus.rockwellcollins.com/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
            <id>nexus</id>
            <name>ALM Maven Repository</name>
            <url>https://misnexus.rockwellcollins.com/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>
    <!-- Getting failure while deploying to nexus at the below step -->
    <scm>
        <developerConnection>scm:git:${alm.scm.git.url}/scm/almdevg/${project.artifactId}.git</developerConnection>
        <connection>scm:git:${alm.scm.git.url}/scm/almdevg/${project.artifactId}.git</connection>
        <url>${alm.scm.git.url}/projects/ALMDEVG/repos/${project.artifactId}/browse</url>
        <tag>automated-acceptance-tests-1.0.109</tag>
    </scm>

</project>

Below is the pom.xml file of the one child project:

<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>
        <groupId>com.rc.alm</groupId>
        <artifactId>automated-acceptance-tests</artifactId>
        <version>1.0.113-SNAPSHOT</version>
    </parent>

    <artifactId>automated-acceptance-tests-services</artifactId>
    <packaging>jar</packaging>
        
    <name>Automated test services for Jira configuration</name>
    <url>https://misalm.rockwellcollins.com/wiki/display/ALMDEVW</url>

    <properties>
        <jersey-version>2.5.1</jersey-version>
        <jackson-version>2.6.3</jackson-version>
        <apache-commons-configuration-version>2.2</apache-commons-configuration-version>
        <apache-commons-beanutils-version>1.9.2</apache-commons-beanutils-version>
        <apache-http-version>4.5.4</apache-http-version>
        <poi-version>3.9</poi-version>
        <commons-io-version>2.6</commons-io-version>
        <log4j-version>2.17.0</log4j-version>       
    </properties>

    <dependencies>
            
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-configuration2</artifactId>
            <version>${apache-commons-configuration-version}</version>
        </dependency>
        
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io-version}</version>
        </dependency>
                
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <version>${jersey-version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson-version}</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${apache-http-version}</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>${poi-version}</version>
        </dependency>
                
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
        </dependency>       
                        
    </dependencies>

</project>

Below is the pom.xml file of the another child project:

<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>
            <groupId>com.rc.alm</groupId>
            <artifactId>automated-acceptance-tests</artifactId>
            <version>1.0.113-SNAPSHOT</version>
        </parent>
    
        <artifactId>automated-acceptance-tests-suites</artifactId>
    
        <packaging>jar</packaging>
        <name>Automated test suites for Jira configuration</name>
    
        <properties>
            <selenium-version>4.10.0</selenium-version>
            <selenium-remote-version>4.10.0</selenium-remote-version>       
            <selenium-http-jdk-client-version>4.10.0</selenium-http-jdk-client-version>
            <testng-version>7.8.0</testng-version>
            <itext-version>1.3.1</itext-version>
            <sikulix-version>2.0.1</sikulix-version>
            <hamcrest-version>1.3</hamcrest-version>
            <gson-version>2.8.5</gson-version>
            <ashot-version>1.5.4</ashot-version>
            <sonar.sources>src/main</sonar.sources>
            <log4j-version>2.17.0</log4j-version>
        </properties>
        
        <dependencies>
    
            <dependency>
                <groupId>io.github.bonigarcia</groupId>
                <artifactId>webdrivermanager</artifactId>
                <version>4.4.3</version>
            </dependency>
    
            <dependency>
               <groupId>com.google.guava</groupId>
               <artifactId>guava</artifactId>
               <version>31.1-jre</version>
            </dependency>

            <dependency>
                <groupId>io.rest-assured</groupId>
                <artifactId>rest-assured</artifactId>
                <version>3.0.7</version>
            </dependency>
    
            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-remote-driver</artifactId>
                <version>${selenium-remote-version}</version>
            </dependency>
    
            <dependency>
                <groupId>ru.yandex.qatools.ashot</groupId>
                <artifactId>ashot</artifactId>
                <version>${ashot-version}</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${gson-version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>${hamcrest-version}</version>
                <scope>test</scope>
            </dependency>
    
            <dependency>
                <groupId>com.sikulix</groupId>
                <artifactId>sikulixapi</artifactId>
                <version>${sikulix-version}</version>
            </dependency>
    
            <dependency>
                <groupId>com.rc.alm</groupId>
                <artifactId>automated-acceptance-tests-services</artifactId>
                <version>${project.version}</version>
            </dependency>
    
            <!--
            https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
                <version>${selenium-version}</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.testng/testng -->
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>${testng-version}</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/itext/itext -->
            <dependency>
                <groupId>com.lowagie</groupId>
                <artifactId>itext</artifactId>
                <version>${itext-version}</version>
            </dependency>
    
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjrt</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjweaver</artifactId>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
            <dependency>
                <groupId>com.aventstack</groupId>
                <artifactId>extentreports</artifactId>
                <version>3.0.0</version>
            </dependency>
    
            <!-- Import used in API Manager -->
            <dependency>
                <groupId>com.flipkart.zjsonpatch</groupId>
                <artifactId>zjsonpatch</artifactId>
                <version>0.4.8</version>
            </dependency>
    
        </dependencies>
    
        <build>
            <plugins>
    
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>2.6.1</version>
                    <configuration>
                        <filesets>
                            <fileset>
                                <directory>test-output</directory>
                                <followSymlinks>false</followSymlinks>
                            </fileset>
                            <fileset>
                                <directory>screenshot</directory>
                                <followSymlinks>false</followSymlinks>
                            </fileset>
                        </filesets>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.1.0</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>com.rc.alm.it.tests.suites.RunSuite</mainClass>
                            </manifest>
                        </archive>
                        <descriptors>
                            <descriptor>src/main/resources/assemblies/assembly.xml</descriptor>
                        </descriptors>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.1.2</version>
                    <configuration>
                        <systemPropertyVariables>
                            <com.rc.alm.it.env>${com.rc.alm.it.env}</com.rc.alm.it.env>
                        </systemPropertyVariables>
                        <suiteXmlFiles>
                            <!-- TestNG suite XML files -->
                            <suiteXmlFile>src/main/resources/${suiteXmlFile}</suiteXmlFile>
                        </suiteXmlFiles>
                    </configuration>
                </plugin>
    
    
            </plugins>
        </build>
    
        <profiles>
            <profile>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <id>local8080</id>
                <properties>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                    <com.rc.alm.it.env>local8080</com.rc.alm.it.env>
                </properties>
            </profile>
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>local8076</id>
                <properties>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                    <com.rc.alm.it.env>local8076</com.rc.alm.it.env>
                </properties>
            </profile>
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>local2990</id>
                <properties>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                    <com.rc.alm.it.env>local2990</com.rc.alm.it.env>
                </properties>
            </profile>
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>misalmdev01</id>
                <properties>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                    <com.rc.alm.it.env>misalmdev01</com.rc.alm.it.env>
                </properties>
            </profile>
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>misalmdev02</id>
                <properties>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                    <com.rc.alm.it.env>misalmdev02</com.rc.alm.it.env>
                </properties>
            </profile>
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>misalmdev03</id>
                <properties>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                    <com.rc.alm.it.env>misalmdev03</com.rc.alm.it.env>
                </properties>
            </profile>
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>misalmqa</id>
                <properties>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                    <com.rc.alm.it.env>misalmqa</com.rc.alm.it.env>
                </properties>
            </profile>
            <profile>
                <activation>
                    <activeByDefault>false</activeByDefault>
                </activation>
                <id>misalm</id>
                <properties>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                    <com.rc.alm.it.env>misalm</com.rc.alm.it.env>
                </properties>
            </profile>
            <profile>
                <id>sonarsource</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <properties>
                    <sonar.host.url>
                        http://localhost:9000
                    </sonar.host.url>
                </properties>
            </profile>
        </profiles>
    
    </project>

Test code

WebDriverWait wait = new WebDriverWait(getDriver(), Duration.ofSeconds(5));
        wait.until(ExpectedConditions.invisibilityOfElementLocated(
                By.className("aui-message aui-message-success success closeable shadowed aui-will-close")));

In Eclipse, it is marking red the Selenium wait methods in the automation test code and shows the below error:

The type com.google.common.base.Function cannot be resolved. It is indirectly referenced from required .class
files

I have already added the guava dependency, but still it is throwing the same error.

I have already checked the existing posts and none of them worked.

Please advise.

1 Answers1

0

You need to take care of a couple of things:

  • By.className() would accept only one classname where as you have passed multiple in the line:

    WebDriverWait wait = new WebDriverWait(getDriver(), Duration.ofSeconds(5));
            wait.until(ExpectedConditions.invisibilityOfElementLocated(
                  By.className("aui-message aui-message-success success closeable shadowed aui-will-close")));
    

Instead you can use you can use either of the following locator strategies:

  • Using cssSelector:

    WebDriverWait wait = new WebDriverWait(getDriver(), Duration.ofSeconds(5));
            wait.until(ExpectedConditions.invisibilityOfElementLocated(
                  By.cssSelector(".aui-message.aui-message-success.success.closeable.shadowed.aui-will-close")));
    
  • Using xpath:

    WebDriverWait wait = new WebDriverWait(getDriver(), Duration.ofSeconds(5));
            wait.until(ExpectedConditions.invisibilityOfElementLocated(
                  By.xpath("//*[@class='emptyAssemblyaui-message aui-message-success success closeable shadowed aui-will-close']")));
    
  • Additionally, instead of adding multiple Selenium related dependency:

    • <selenium-version>4.10.0</selenium-version>
    • <selenium-remote-version>4.10.0</selenium-remote-version>
    • <selenium-http-jdk-client-version>4.10.0</selenium-http-jdk-client-version>
    • <gson-version>2.8.5</gson-version>

and

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>31.1-jre</version>
</dependency>
        

Replace them all with one single selenium-remote-driver dependency:

<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-remote-driver</artifactId>
    <version>4.10.0</version>
</dependency>
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • It is throwing errors at multiple places in the test code. Sample: `Errors occurred during the build. Errors running builder 'Maven Project Builder' assertion failed: Marker property value is too long: AJC compiler errors: error at import org.openqa.selenium.support.ui.ExpectedConditions; ^^^^^^^^^^^^^^^^^^^^^^^^^^ The import org.openqa.selenium.support cannot be resolved error at import org.openqa.selenium.support.ui.WebDriverWait;` – Sandesh Sawant Jul 30 '23 at 17:57