Reputation: 95
I want to run my selenium test cases on Chrome/Firefox in maximized state. Currently, I have a pipeline that works and runs my Selenium java tests (mvn test) only in headless mode regardless of the configuration I set in my driver definition. GitLab runner is configured under my VM where all pipeline stages are running. Is there a way or something I am missing with which I can run my tests in a maximized browser state?
Pipeline stage:
stages:
- test_regression_suite
E2E_tests:
image: maven:3-jdk-11
stage: test_regression_suite
tags:
- ci-runner
variables:
JAVA_HOME: "C:\\Program Files\\Java\\jdk1.8.0_361"
script:
- cd pth\to\my\framework\src\runner\file
- mvn test
timeout: 1200 seconds
allow_failure: true
Browser configurations:
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + operatingPlatform);
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("plugins.plugins_disabled", new String[]{"Chrome PDF Viewer"});
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
options.setExperimentalOption("prefs", prefs);
HashMap<String, Object> options1 = new HashMap<String, Object>();
options1.put("prefs", prefs);
driver = new ChromeDriver(options);
Despite the option ("--start-maximized") already defined above, it still runs the test cases in the headless mode because of which several of my test cases are getting failed (due to application UI dependencies).
Upvotes: 0
Views: 73
Reputation: 95
So we connected with the GitLab support team on this and it seems to be a limitation from the runner that it always runs tests in a headless mode regardless of what configurations are applied in the automation framework. Also, this goes for other scripts (PowerShell or ms cmd) and the execution will be done in silent/ headless mode.
Upvotes: 0