Skip to content

Instantly share code, notes, and snippets.

@slawekradzyminski
Last active August 4, 2017 01:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slawekradzyminski/a3391ddc4415918936def0d71cb823cb to your computer and use it in GitHub Desktop.
Save slawekradzyminski/a3391ddc4415918936def0d71cb823cb to your computer and use it in GitHub Desktop.
public class HeadlessChromeConfig extends FluentTestNg {
private static final String HEADLESS = "headless";
@Override
public WebDriver newWebDriver() {
return new ChromeDriver(getChromeCapabilities());
}
private DesiredCapabilities getChromeCapabilities() {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, getChromeOptions());
return capabilities;
}
private ChromeOptions getChromeOptions() {
ChromeOptions options = new ChromeOptions();
options.addArguments(getChromeSwitches());
return options;
}
private List<String> getChromeSwitches() {
List<String> chromeSwitches = new ArrayList<>();
chromeSwitches.add(HEADLESS);
return chromeSwitches;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment