Skip to content

Commit 47a2730

Browse files
committed
[grid] Fixing remote execution for Edge when Java 8 client is used
1 parent 93fa5f9 commit 47a2730

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

java/src/org/openqa/selenium/edge/EdgeDriverInfo.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package org.openqa.selenium.edge;
1818

1919
import com.google.auto.service.AutoService;
20+
import com.google.common.collect.ImmutableList;
21+
import com.google.common.collect.ImmutableMap;
2022

2123
import org.openqa.selenium.Capabilities;
2224
import org.openqa.selenium.ImmutableCapabilities;
@@ -25,12 +27,12 @@
2527
import org.openqa.selenium.WebDriverException;
2628
import org.openqa.selenium.WebDriverInfo;
2729
import org.openqa.selenium.chromium.ChromiumDriverInfo;
30+
import org.openqa.selenium.remote.CapabilityType;
2831
import org.openqa.selenium.remote.service.DriverFinder;
2932

3033
import java.util.Optional;
3134

3235
import static org.openqa.selenium.remote.Browser.EDGE;
33-
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
3436

3537
@AutoService(WebDriverInfo.class)
3638
public class EdgeDriverInfo extends ChromiumDriverInfo {
@@ -42,7 +44,14 @@ public String getDisplayName() {
4244

4345
@Override
4446
public Capabilities getCanonicalCapabilities() {
45-
return new ImmutableCapabilities(BROWSER_NAME, EDGE.browserName());
47+
// Allowing any origin "*" through remote-allow-origins might sound risky but an attacker
48+
// would need to know the port used to start DevTools to establish a connection. Given
49+
// these sessions are relatively short-lived, the risk is reduced. Also, this will be
50+
// removed when we only support Java 11 and above.
51+
return new ImmutableCapabilities(
52+
CapabilityType.BROWSER_NAME, EDGE.browserName(),
53+
EdgeOptions.CAPABILITY,
54+
ImmutableMap.of("args", ImmutableList.of("--remote-allow-origins=*")));
4655
}
4756

4857
@Override

0 commit comments

Comments
 (0)