File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -33,5 +33,25 @@ public async Task TestCanInterceptNetworkCalls()
33
33
Assert . AreEqual ( "I intercepted you" , text ) ;
34
34
}
35
35
}
36
+
37
+ [ Test ]
38
+ public async Task TestCanUseAuthorizationHandler ( )
39
+ {
40
+ if ( driver is IDevTools )
41
+ {
42
+ INetwork network = driver . Manage ( ) . Network ;
43
+ NetworkAuthenticationHandler handler = new NetworkAuthenticationHandler ( )
44
+ {
45
+ UriMatcher = ( uri ) => uri . PathAndQuery . Contains ( "basicAuth" ) ,
46
+ Credentials = new PasswordCredentials ( "test" , "test" )
47
+ } ;
48
+ network . AddAuthenticationHandler ( handler ) ;
49
+ await network . StartMonitoring ( ) ;
50
+ driver . Url = authenticationPage ;
51
+ string text = driver . FindElement ( By . CssSelector ( "h1" ) ) . Text ;
52
+ await network . StopMonitoring ( ) ;
53
+ Assert . AreEqual ( "authorized" , text ) ;
54
+ }
55
+ }
36
56
}
37
57
}
You can’t perform that action at this time.
0 commit comments