I am new with docker containers and testing and have no idea how to solve this, been having a hard time these days. My tests are working in windows but when I create the docker container, my tests are not working, so I want to run a maven project in a docker container. The thing is I have been solving a lot of errors but still lots of them. Before I start, I use openstax/selenium-chrome image with java, maven,chromedriver already installed and JAVA_HOME already set. Java version is 17 on the container and the project has 1.8.
Chromedriver version is ChromeDriver 88.0.4324.96
Google-chrome version is Google Chrome 88.0.4324.96
1- I create the docker container from the image I already created with everything installed passing the maven project inside.
docker run -it -d -v C:\Users\user\Projects\TestAutomation:/app --name=testsel maven-selenium/selenium
2- I enter with the user
docker exec -it testsel /bin/bash
3- I switch to the directory that I have the mvn project
4- I execute the maven project with mvn test 5- this is my pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<includes>
<include>org/nameofproject/tests/Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
6- Setting chrome options for linux
ChromeOptions options = new ChromeOptions();
options.addArguments("--window-size=1920,1080");
options.addArguments("--disable-gpu");
options.addArguments("--disable-extensions");
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments("--proxy-server='direct://'");
options.addArguments("--proxy-bypass-list=*");
options.addArguments("--start-maximized");
options.addArguments("--headless");
System.setProperty("webdriver.chrome.driver","/usr/bin/chromedriver");
driver = new ChromeDriver(options);
and at the end another error
Expected condition failed: waiting for visibility of element located by By.id: username (tried for 60 second(s) with 500 milliseconds interval)(..)
I am using explicit wait in locating the elements
wait = new WebDriverWait(driver, Duration.ofSeconds(60));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("username"))).sendKeys(Const.user);
but still not working.
Edit:
This is the complete error at the end of test execution.
It fails at CBLogin because it's not finding the username element.


