1717package org .openqa .selenium .edge ;
1818
1919import com .google .auto .service .AutoService ;
20+ import com .google .common .collect .ImmutableList ;
21+ import com .google .common .collect .ImmutableMap ;
2022
2123import org .openqa .selenium .Capabilities ;
2224import org .openqa .selenium .ImmutableCapabilities ;
2527import org .openqa .selenium .WebDriverException ;
2628import org .openqa .selenium .WebDriverInfo ;
2729import org .openqa .selenium .chromium .ChromiumDriverInfo ;
30+ import org .openqa .selenium .remote .CapabilityType ;
2831import org .openqa .selenium .remote .service .DriverFinder ;
2932
3033import java .util .Optional ;
3134
3235import static org .openqa .selenium .remote .Browser .EDGE ;
33- import static org .openqa .selenium .remote .CapabilityType .BROWSER_NAME ;
3436
3537@ AutoService (WebDriverInfo .class )
3638public 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