-
Notifications
You must be signed in to change notification settings - Fork 14
Open browser in headless mode
Ha Do edited this page Aug 22, 2020
·
1 revision
public static WebDriver openHeadlessBrowser(String name) {
switch (name.toLowerCase()) {
case "chrome":
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setHeadless(true);
return new ChromeDriver(chromeOptions);
case "firefox":
FirefoxBinary firefoxBinary = new FirefoxBinary();
firefoxBinary.addCommandLineOptions("--headless");
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setBinary(firefoxBinary);
return new FirefoxDriver(firefoxOptions);
default:
throw new IllegalArgumentException("The browser " + name + " dose not support!!!");
}
}
-
Nội dung khoá học kiểm thử tự động căn bản với Selenium và Java
-
Open browsers with selenium and java:
2.1. Edge
2.2. Headless browsers
2.3. Chrome mobile mode