File tree Expand file tree Collapse file tree
java/test/org/openqa/selenium/virtualauthenticator Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323import static org .assertj .core .api .InstanceOfAssertFactories .MAP ;
2424import static org .junit .jupiter .api .Assertions .assertThrows ;
2525
26+ import java .net .MalformedURLException ;
27+ import java .net .URI ;
28+ import java .net .URL ;
2629import java .security .spec .PKCS8EncodedKeySpec ;
2730import java .util .Arrays ;
2831import java .util .Base64 ;
@@ -66,10 +69,24 @@ class VirtualAuthenticatorTest extends JupiterTestBase {
6669 private VirtualAuthenticator authenticator ;
6770
6871 @ BeforeEach
69- public void setup () {
72+ public void setup () throws MalformedURLException {
7073 assumeThat (driver ).isInstanceOf (HasVirtualAuthenticator .class );
7174 jsAwareDriver = (JavascriptExecutor ) driver ;
72- driver .get (appServer .whereIs ("virtual-authenticator.html" ));
75+
76+ // According to the spec, the only way we can use the virtual
77+ // authenticator is if we are using HTTPS or contacting
78+ // `localhost` directly. When we try and access the `NettyAppServer`
79+ // over HTTPS, the `registerCredential` method is missing. Let's
80+ // make the assumption that the server being used is running on
81+ // `localhost` and rewrite URLs from there.
82+ URL url = new URL (appServer .whereIs ("virtual-authenticator.html" ));
83+ String localUrl = new URL (
84+ url .getProtocol (),
85+ "localhost" ,
86+ url .getPort (),
87+ url .getFile ()).toString ();
88+
89+ driver .get (localUrl );
7390 }
7491
7592 private void createRKEnabledU2FAuthenticator () {
You can’t perform that action at this time.
0 commit comments