@@ -128,6 +128,7 @@ public class InternetExplorerOptions
128128 private const string EnsureCleanSessionCapability = "ie.ensureCleanSession" ;
129129 private const string ForceShellWindowsApiCapability = "ie.forceShellWindowsApi" ;
130130 private const string ValidateCookieDocumentTypeCapability = "ie.validateCookieDocumentType" ;
131+ private const string FileUploadDialogTimeoutCapability = "ie.fileUploadDialogTimeout" ;
131132
132133 private bool ignoreProtectedModeSettings ;
133134 private bool ignoreZoomLevel ;
@@ -140,6 +141,7 @@ public class InternetExplorerOptions
140141 private bool ensureCleanSession ;
141142 private bool validateCookieDocumentType = true ;
142143 private TimeSpan browserAttachTimeout = TimeSpan . MinValue ;
144+ private TimeSpan fileUploadDialogTimeout = TimeSpan . MinValue ;
143145 private string initialBrowserUrl = string . Empty ;
144146 private string browserCommandLineArguments = string . Empty ;
145147 private InternetExplorerElementScrollBehavior elementScrollBehavior = InternetExplorerElementScrollBehavior . Top ;
@@ -250,6 +252,16 @@ public TimeSpan BrowserAttachTimeout
250252 set { this . browserAttachTimeout = value ; }
251253 }
252254
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+
253265 /// <summary>
254266 /// Gets or sets a value indicating whether to force the use of the Windows CreateProcess API
255267 /// when launching Internet Explorer. The default value is <see langword="false"/>.
@@ -359,7 +371,8 @@ public void AddAdditionalCapability(string capabilityName, object capabilityValu
359371 capabilityName == UsePerProcessProxyCapability ||
360372 capabilityName == EnsureCleanSessionCapability ||
361373 capabilityName == ValidateCookieDocumentTypeCapability ||
362- capabilityName == CapabilityType . PageLoadStrategy )
374+ capabilityName == CapabilityType . PageLoadStrategy ||
375+ capabilityName == FileUploadDialogTimeoutCapability )
363376 {
364377 string message = string . Format ( CultureInfo . InvariantCulture , "There is already an option for the {0} capability. Please use that instead." , capabilityName ) ;
365378 throw new ArgumentException ( message , "capabilityName" ) ;
@@ -449,6 +462,11 @@ public ICapabilities ToCapabilities()
449462 capabilities . SetCapability ( BrowserAttachTimeoutCapability , Convert . ToInt32 ( this . browserAttachTimeout . TotalMilliseconds ) ) ;
450463 }
451464
465+ if ( this . fileUploadDialogTimeout != TimeSpan . MinValue )
466+ {
467+ capabilities . SetCapability ( FileUploadDialogTimeoutCapability , Convert . ToInt32 ( this . fileUploadDialogTimeout . TotalMilliseconds ) ) ;
468+ }
469+
452470 if ( this . forceCreateProcessApi )
453471 {
454472 capabilities . SetCapability ( ForceCreateProcessApiCapability , true ) ;
0 commit comments