make headless a local var and use it correctly
This commit is contained in:
parent
62959be1c3
commit
a678f2f348
@ -20,11 +20,9 @@ import java.util.List;
|
|||||||
public class BrowserDriver extends RemoteWebDriver {
|
public class BrowserDriver extends RemoteWebDriver {
|
||||||
private final RemoteWebDriver driver;
|
private final RemoteWebDriver driver;
|
||||||
private final String browser;
|
private final String browser;
|
||||||
private final Boolean headless;
|
|
||||||
|
|
||||||
public BrowserDriver(final String browser, final Boolean headless){
|
public BrowserDriver(final String browser, final Boolean headless){
|
||||||
this.browser = browser;
|
this.browser = browser;
|
||||||
this.headless = headless;
|
|
||||||
|
|
||||||
switch (browser) {
|
switch (browser) {
|
||||||
case "chrome": this.driver = getChrome(headless);
|
case "chrome": this.driver = getChrome(headless);
|
||||||
@ -47,7 +45,7 @@ public class BrowserDriver extends RemoteWebDriver {
|
|||||||
validateBrowser();
|
validateBrowser();
|
||||||
WebDriverManager.chromedriver().setup();
|
WebDriverManager.chromedriver().setup();
|
||||||
ChromeOptions options = new ChromeOptions();
|
ChromeOptions options = new ChromeOptions();
|
||||||
options.setHeadless(true);
|
options.setHeadless(headless);
|
||||||
options.addArguments("--ignore-certificate-errors"); // only for limited test envs
|
options.addArguments("--ignore-certificate-errors"); // only for limited test envs
|
||||||
return new ChromeDriver(options);
|
return new ChromeDriver(options);
|
||||||
}
|
}
|
||||||
@ -56,7 +54,7 @@ public class BrowserDriver extends RemoteWebDriver {
|
|||||||
validateBrowser();
|
validateBrowser();
|
||||||
WebDriverManager.firefoxdriver().setup();
|
WebDriverManager.firefoxdriver().setup();
|
||||||
FirefoxOptions options = new FirefoxOptions();
|
FirefoxOptions options = new FirefoxOptions();
|
||||||
options.setHeadless(true);
|
options.setHeadless(headless);
|
||||||
options.addArguments("--ignore-certificate-errors");
|
options.addArguments("--ignore-certificate-errors");
|
||||||
return new FirefoxDriver(options);
|
return new FirefoxDriver(options);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user