Skip to content

Commit f6ae59d

Browse files
committed
Added EDGE_HEADLESS browser option
1 parent 1adc0c4 commit f6ae59d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

bellatrix.web/src/main/java/solutions/bellatrix/web/infrastructure/Browser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ public enum Browser {
2222
FIREFOX("firefox"),
2323
FIREFOX_HEADLESS("firefox_headless"),
2424
EDGE("edge"),
25-
// EDGE_HEADLESS("edge"), // Unsupported by Selenium 3, Selenium 4 has support
25+
EDGE_HEADLESS("edge"),
2626
OPERA("opera"),
2727
SAFARI("safari"),
28-
NOT_SET("not_set"),
29-
INTERNET_EXPLORER("ie");
28+
INTERNET_EXPLORER("ie"),
29+
NOT_SET("not_set");
3030

3131
private final String value;
3232

bellatrix.web/src/main/java/solutions/bellatrix/web/infrastructure/DriverService.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ private static WebDriver initializeDriverCloudGridMode(GridSettings gridSettings
139139
caps.setCapability(ChromeOptions.CAPABILITY, firefoxOptions);
140140
break;
141141
}
142+
case EDGE_HEADLESS:
142143
case EDGE: {
143144
var edgeOptions = new EdgeOptions();
144145
caps.setCapability(ChromeOptions.CAPABILITY, edgeOptions);
@@ -201,6 +202,7 @@ private static WebDriver initializeDriverGridMode(GridSettings gridSettings) {
201202
caps.setCapability(ChromeOptions.CAPABILITY, firefoxOptions);
202203
break;
203204
}
205+
case EDGE_HEADLESS:
204206
case EDGE: {
205207
var edgeOptions = new EdgeOptions();
206208
addGridOptions(edgeOptions, gridSettings);
@@ -310,6 +312,14 @@ private static WebDriver initializeDriverRegularMode() {
310312
if (shouldCaptureHttpTraffic) edgeOptions.setProxy(proxyConfig);
311313
driver = new EdgeDriver(edgeOptions);
312314
}
315+
case EDGE_HEADLESS -> {
316+
var edgeOptions = new EdgeOptions();
317+
edgeOptions.addArguments("--headless");
318+
edgeOptions.addArguments("--disable-gpu");
319+
addDriverOptions(edgeOptions);
320+
if (shouldCaptureHttpTraffic) edgeOptions.setProxy(proxyConfig);
321+
driver = new EdgeDriver(edgeOptions);
322+
}
313323
case SAFARI -> {
314324
System.setProperty("webdriver.safari.driver", "/usr/bin/safaridriver");
315325
var safariOptions = new SafariOptions();

0 commit comments

Comments
 (0)