Selenium Starter Kit - incognito mode test run
Hi all
We use SeleniumStarterKit-based framework for test automation in our project. There is a requirement to implement parallel testing, and as we have only on test operator, it`s crucial to aplly incognito mode to a browser instance created in test. We use Chrome and chromedriver to run our tests.
There is a global-settings property provided for apllying browser capabilities w/o changing configuration, however setting "capabilities" property equal "chrome.switches:--incognito" doesn`t help. During some research I found out that browser instance is initialized in initializeEnvironment function of TestEnvironmentImplementation class.
private void initializeEnvironment(String browserName, DesiredCapabilities caps, String platformName) {
....
this.driver = this.createDriverInstance(browserName, caps, platform);
this.pegaDriver = new PegaWebDriverImpl(this.driver, this);
....
}
This function receives DesiredCapabilities object from other private function with the same name, and those capabilities are never read from global-settings.properties.
private void initializeEnvironment(String browserName, String platform) {
...
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("acceptSslCerts", true);
this.initializeEnvironment(browserName, capabilities, platform);
...
}
My question is:
Hi all
We use SeleniumStarterKit-based framework for test automation in our project. There is a requirement to implement parallel testing, and as we have only on test operator, it`s crucial to aplly incognito mode to a browser instance created in test. We use Chrome and chromedriver to run our tests.
There is a global-settings property provided for apllying browser capabilities w/o changing configuration, however setting "capabilities" property equal "chrome.switches:--incognito" doesn`t help. During some research I found out that browser instance is initialized in initializeEnvironment function of TestEnvironmentImplementation class.
private void initializeEnvironment(String browserName, DesiredCapabilities caps, String platformName) {
....
this.driver = this.createDriverInstance(browserName, caps, platform);
this.pegaDriver = new PegaWebDriverImpl(this.driver, this);
....
}
This function receives DesiredCapabilities object from other private function with the same name, and those capabilities are never read from global-settings.properties.
private void initializeEnvironment(String browserName, String platform) {
...
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("acceptSslCerts", true);
this.initializeEnvironment(browserName, capabilities, platform);
...
}
My question is:
Is there another place where we can set required capabilities for browser instance, or the only place to do it is initializeEnvironment() in TestEnvironmentImplementation.
If no, should custom TestEnvironment implementation be made as all the methods where we can set up a browser as required are private and can`t be overriden in child class?
Thank you!