@@ -66,6 +66,29 @@ public enum InternetExplorerUnexpectedAlertBehavior
66
66
Dismiss
67
67
}
68
68
69
+ public enum InternetExplorerPageLoadStrategy
70
+ {
71
+ /// <summary>
72
+ /// Indicates the behavior is not set.
73
+ /// </summary>
74
+ Default ,
75
+
76
+ /// <summary>
77
+ /// Waits for pages to load and ready state to be 'complete'.
78
+ /// </summary>
79
+ Normal ,
80
+
81
+ /// <summary>
82
+ /// Waits for pages to load and for ready state to be 'interactive' or 'complete'.
83
+ /// </summary>
84
+ Eager ,
85
+
86
+ /// <summary>
87
+ /// Does not wait for pages to load, returning immediately.
88
+ /// </summary>
89
+ None
90
+ }
91
+
69
92
/// <summary>
70
93
/// Class to manage options specific to <see cref="InternetExplorerDriver"/>
71
94
/// </summary>
@@ -109,7 +132,7 @@ public class InternetExplorerOptions
109
132
private bool requireWindowFocus ;
110
133
private bool enablePersistentHover = true ;
111
134
private bool forceCreateProcessApi ;
112
- private bool forceShellWindowsApi ;
135
+ private bool forceShellWindowsApi = true ;
113
136
private bool usePerProcessProxy ;
114
137
private bool ensureCleanSession ;
115
138
private bool validateCookieDocumentType = true ;
@@ -118,6 +141,7 @@ public class InternetExplorerOptions
118
141
private string browserCommandLineArguments = string . Empty ;
119
142
private InternetExplorerElementScrollBehavior elementScrollBehavior = InternetExplorerElementScrollBehavior . Top ;
120
143
private InternetExplorerUnexpectedAlertBehavior unexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior . Default ;
144
+ private InternetExplorerPageLoadStrategy pageLoadStrategy = InternetExplorerPageLoadStrategy . Default ;
121
145
private Proxy proxy ;
122
146
private Dictionary < string , object > additionalCapabilities = new Dictionary < string , object > ( ) ;
123
147
@@ -193,6 +217,16 @@ public InternetExplorerUnexpectedAlertBehavior UnexpectedAlertBehavior
193
217
set { this . unexpectedAlertBehavior = value ; }
194
218
}
195
219
220
+ /// <summary>
221
+ /// Gets or sets the value for describing how the browser is to wait for pages to load in the IE driver.
222
+ /// Defaults to <see cref="InternetExplorerPageLoadStrategy.Default"/>.
223
+ /// </summary>
224
+ public InternetExplorerPageLoadStrategy PageLoadStrategy
225
+ {
226
+ get { return this . pageLoadStrategy ; }
227
+ set { this . pageLoadStrategy = value ; }
228
+ }
229
+
196
230
/// <summary>
197
231
/// Gets or sets a value indicating whether to enable persistently sending WM_MOUSEMOVE messages
198
232
/// to the IE window during a mouse hover.
@@ -321,7 +355,8 @@ public void AddAdditionalCapability(string capabilityName, object capabilityValu
321
355
capabilityName == CapabilityType . Proxy ||
322
356
capabilityName == UsePerProcessProxyCapability ||
323
357
capabilityName == EnsureCleanSessionCapability ||
324
- capabilityName == ValidateCookieDocumentTypeCapability )
358
+ capabilityName == ValidateCookieDocumentTypeCapability ||
359
+ capabilityName == CapabilityType . PageLoadStrategy )
325
360
{
326
361
string message = string . Format ( CultureInfo . InvariantCulture , "There is already an option for the {0} capability. Please use that instead." , capabilityName ) ;
327
362
throw new ArgumentException ( message , "capabilityName" ) ;
@@ -389,6 +424,23 @@ public ICapabilities ToCapabilities()
389
424
capabilities . SetCapability ( CapabilityType . UnexpectedAlertBehavior , unexpectedAlertBehaviorSetting ) ;
390
425
}
391
426
427
+ if ( this . pageLoadStrategy != InternetExplorerPageLoadStrategy . Default )
428
+ {
429
+ string pageLoadStrategySetting = "normal" ;
430
+ switch ( this . pageLoadStrategy )
431
+ {
432
+ case InternetExplorerPageLoadStrategy . Eager :
433
+ pageLoadStrategySetting = "eager" ;
434
+ break ;
435
+
436
+ case InternetExplorerPageLoadStrategy . None :
437
+ pageLoadStrategySetting = "none" ;
438
+ break ;
439
+ }
440
+
441
+ capabilities . SetCapability ( CapabilityType . PageLoadStrategy , pageLoadStrategySetting ) ;
442
+ }
443
+
392
444
if ( this . browserAttachTimeout != TimeSpan . MinValue )
393
445
{
394
446
capabilities . SetCapability ( BrowserAttachTimeoutCapability , Convert . ToInt32 ( this . browserAttachTimeout . TotalMilliseconds ) ) ;
0 commit comments