@@ -128,6 +128,7 @@ public class InternetExplorerOptions
128
128
private const string EnsureCleanSessionCapability = "ie.ensureCleanSession" ;
129
129
private const string ForceShellWindowsApiCapability = "ie.forceShellWindowsApi" ;
130
130
private const string ValidateCookieDocumentTypeCapability = "ie.validateCookieDocumentType" ;
131
+ private const string FileUploadDialogTimeoutCapability = "ie.fileUploadDialogTimeout" ;
131
132
132
133
private bool ignoreProtectedModeSettings ;
133
134
private bool ignoreZoomLevel ;
@@ -140,6 +141,7 @@ public class InternetExplorerOptions
140
141
private bool ensureCleanSession ;
141
142
private bool validateCookieDocumentType = true ;
142
143
private TimeSpan browserAttachTimeout = TimeSpan . MinValue ;
144
+ private TimeSpan fileUploadDialogTimeout = TimeSpan . MinValue ;
143
145
private string initialBrowserUrl = string . Empty ;
144
146
private string browserCommandLineArguments = string . Empty ;
145
147
private InternetExplorerElementScrollBehavior elementScrollBehavior = InternetExplorerElementScrollBehavior . Top ;
@@ -250,6 +252,16 @@ public TimeSpan BrowserAttachTimeout
250
252
set { this . browserAttachTimeout = value ; }
251
253
}
252
254
255
+ /// <summary>
256
+ /// Gets or sets the amount of time the driver will attempt to look for the file selection
257
+ /// dialog when attempting to upload a file.
258
+ /// </summary>
259
+ public TimeSpan FileUploadDialogTimeout
260
+ {
261
+ get { return this . fileUploadDialogTimeout ; }
262
+ set { this . fileUploadDialogTimeout = value ; }
263
+ }
264
+
253
265
/// <summary>
254
266
/// Gets or sets a value indicating whether to force the use of the Windows CreateProcess API
255
267
/// when launching Internet Explorer. The default value is <see langword="false"/>.
@@ -359,7 +371,8 @@ public void AddAdditionalCapability(string capabilityName, object capabilityValu
359
371
capabilityName == UsePerProcessProxyCapability ||
360
372
capabilityName == EnsureCleanSessionCapability ||
361
373
capabilityName == ValidateCookieDocumentTypeCapability ||
362
- capabilityName == CapabilityType . PageLoadStrategy )
374
+ capabilityName == CapabilityType . PageLoadStrategy ||
375
+ capabilityName == FileUploadDialogTimeoutCapability )
363
376
{
364
377
string message = string . Format ( CultureInfo . InvariantCulture , "There is already an option for the {0} capability. Please use that instead." , capabilityName ) ;
365
378
throw new ArgumentException ( message , "capabilityName" ) ;
@@ -449,6 +462,11 @@ public ICapabilities ToCapabilities()
449
462
capabilities . SetCapability ( BrowserAttachTimeoutCapability , Convert . ToInt32 ( this . browserAttachTimeout . TotalMilliseconds ) ) ;
450
463
}
451
464
465
+ if ( this . fileUploadDialogTimeout != TimeSpan . MinValue )
466
+ {
467
+ capabilities . SetCapability ( FileUploadDialogTimeoutCapability , Convert . ToInt32 ( this . fileUploadDialogTimeout . TotalMilliseconds ) ) ;
468
+ }
469
+
452
470
if ( this . forceCreateProcessApi )
453
471
{
454
472
capabilities . SetCapability ( ForceCreateProcessApiCapability , true ) ;
0 commit comments