@@ -30,6 +30,14 @@ internal class Navigator : INavigation
3030 {
3131 private WebDriver driver ;
3232 private string browsingContextId ;
33+ private static readonly Dictionary < string , ReadinessState > PageLoadStrategyMapper = new ( )
34+ {
35+ { "normal" , ReadinessState . Complete } ,
36+ { "default" , ReadinessState . Complete } ,
37+ { "eager" , ReadinessState . Interactive } ,
38+ { "none" , ReadinessState . None }
39+ } ;
40+ private ReadinessState readinessState ;
3341
3442 /// <summary>
3543 /// Initializes a new instance of the <see cref="Navigator"/> class
@@ -119,7 +127,11 @@ public async Task GoToUrlAsync(string url)
119127
120128 if ( this . driver . BiDiDriver != null )
121129 {
122- await driver . BiDiDriver . BrowsingContext . NavigateAsync ( new NavigateCommandParameters ( this . browsingContextId , url ) ) . ConfigureAwait ( false ) ;
130+ NavigateCommandParameters navigateCommandParameters = new NavigateCommandParameters ( this . browsingContextId , url )
131+ {
132+ Wait = this . readinessState
133+ } ;
134+ await driver . BiDiDriver . BrowsingContext . NavigateAsync ( navigateCommandParameters ) . ConfigureAwait ( false ) ;
123135 }
124136 else
125137 {
@@ -172,7 +184,10 @@ public async Task RefreshAsync()
172184 if ( this . driver . BiDiDriver != null )
173185 {
174186 var reloadCommandParameters =
175- new ReloadCommandParameters ( this . browsingContextId ) ;
187+ new ReloadCommandParameters ( this . browsingContextId )
188+ {
189+ Wait = this . readinessState
190+ } ;
176191 await this . driver . BiDiDriver . BrowsingContext . ReloadAsync ( reloadCommandParameters ) . ConfigureAwait ( false ) ;
177192 }
178193 else
0 commit comments