I created a pattern Selenium Webdriver take a look at utilizing java and maven and pushed it out to my gitlab repository. Then I created a new pipeline to run the automated checks. That is my first time operating a take a look at on the pipeline so I adopted some directions on-line. The difficulty I am having is that the take a look at fails due to this error: (unknown error: DevToolsActivePort file does not exist)
I noticed some few questions concerning this too and tried so as to add these options however nonetheless getting that error. Used this hyperlink the place I added these arguments.
WebDriverException: unknown error: DevToolsActivePort file does not exist whereas attempting to provoke Chrome Browser
Undecided what I have to do to repair this error or run the take a look at as a non-root consumer which might perhaps be a workaround.
That is my yml file for the pipeline
# calling the docker picture the place chrome, maven, jdk can be found to run the checks
picture: markhobson/maven-chrome:jdk-11
# constructing the maven
construct:
stage: construct
script:
- mvn compile
# operating the checks
take a look at:
stage: take a look at
script:
- mvn clear take a look at
BaseTest class
@BeforeSuite
public void beforeSuite() {
WebDriverManager.chromedriver().setup();
ChromeOptions choices = new ChromeOptions();
String runTime = null;
attempt {
InputStream enter = BaseTest.class.getClassLoader().getResourceAsStream("runSetup.properties");
Properties properties = new Properties();
properties.load(enter);
runTime = properties.getProperty("runTimeOnLocal");
} catch (IOException e) {
e.printStackTrace();
}
// if it is true, meaning operating domestically on my machine and open the webrowser
// if it is false, meaning it is operating on gitlab headless
if(runTime.equalsIgnoreCase("TRUE")) {
choices.addArguments("start-maximized");
choices.addArguments("enable-automation");
choices.addArguments("--no-sandbox");
choices.addArguments("--disable-infobars");
choices.addArguments("--disable-dev-shm-usage");
choices.addArguments("--disable-browser-side-navigation");
choices.addArguments("--disable-gpu");
}
else if(runTime.equalsIgnoreCase("FALSE")) {
choices.addArguments("--disable-dev-shm-usage");
choices.addArguments("--no-sandbox");
choices.addArguments("--disable-gpu");
choices.setHeadless(true);
}
driver.set(new ChromeDriver(choices));
Log.information("Opening internet utility");
driver.get().get("https://demo.opencart.com/");
}
I additionally put the hyperlink to my repo as it is a pattern for me to assessment selenium (want to modify to grasp department)