Headless
This commit is contained in:
@@ -5,6 +5,7 @@ import java.time.Duration;
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.chrome.ChromeOptions;
|
||||
import org.openqa.selenium.edge.EdgeDriver;
|
||||
import org.openqa.selenium.edge.EdgeOptions;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
@@ -23,30 +24,25 @@ public class BaseTest {
|
||||
if (browser != null && browser.equalsIgnoreCase("firefox")) {
|
||||
FirefoxOptions options = new FirefoxOptions();
|
||||
options.addArguments("--start-maximized");
|
||||
/* Activar si fa falta el driver en el PATH del sistema
|
||||
System.setProperty("webdriver.gecko.driver",
|
||||
"src" + File.separator + "test"
|
||||
+ File.separator + "resources"
|
||||
+ File.separator + "geckodriver-macos");*/
|
||||
driver = new FirefoxDriver(options);
|
||||
} else if (browser != null && browser.equalsIgnoreCase("edge")) {
|
||||
EdgeOptions options = new EdgeOptions();
|
||||
/* Activar si fa falta el driver en el PATH del sistema
|
||||
System.setProperty("webdriver.edge.driver",
|
||||
"src" + File.separator + "test"
|
||||
+ File.separator + "resources"
|
||||
+ File.separator + "msedgedriver-macos");*/
|
||||
driver = new EdgeDriver(options);
|
||||
}
|
||||
else if(browser != null && browser.equalsIgnoreCase("safari")){
|
||||
driver = new SafariDriver();
|
||||
}
|
||||
else if(browser != null && browser.equalsIgnoreCase("chromeheadless")){
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--headless");
|
||||
driver = new ChromeDriver(options);
|
||||
}
|
||||
else if(browser != null && browser.equalsIgnoreCase("firefoxheadless")){
|
||||
FirefoxOptions options = new FirefoxOptions();
|
||||
options.addArguments("--headless");
|
||||
driver = new FirefoxDriver(options);
|
||||
}
|
||||
else {
|
||||
/* Activar si fa falta el driver en el PATH del sistema
|
||||
System.setProperty("webdriver.chrome.driver", "src"
|
||||
+ File.separator
|
||||
+ "test" + File.separator + "resources"
|
||||
+ File.separator + "chromedriver-macos");*/
|
||||
driver = new ChromeDriver();
|
||||
}
|
||||
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
|
||||
|
||||
Reference in New Issue
Block a user