@@ -279,13 +279,18 @@ public virtual void SendKeys(string text)
279279 {
280280 throw new ArgumentNullException ( "text" , "text cannot be null" ) ;
281281 }
282- var fileNames = text . Split ( "\n " ) ;
282+ var fileNames = text . Split ( '\n ' ) ;
283+ var amendedText = "" ;
283284 foreach ( var fileName in fileNames )
284285 {
285286 if ( this . driver . FileDetector . IsFile ( fileName ) )
286287 {
287- fileName = this . UploadFile ( fileName ) ) ;
288- }
288+ amendedText += this . UploadFile ( fileName ) + "\n " ;
289+ }
290+ else
291+ {
292+ amendedText = fileName + "\n " ;
293+ }
289294 }
290295 // N.B. The Java remote server expects a CharSequence as the value input to
291296 // SendKeys. In JSON, these are serialized as an array of strings, with a
@@ -295,8 +300,8 @@ public virtual void SendKeys(string text)
295300 // appropriate one for spec compliance.
296301 Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
297302 parameters . Add ( "id" , this . elementId ) ;
298- parameters . Add ( "text" , text ) ;
299- parameters . Add ( "value" , text . ToCharArray ( ) ) ;
303+ parameters . Add ( "text" , amendedText ) ;
304+ parameters . Add ( "value" , amendedText . ToCharArray ( ) ) ;
300305
301306 this . Execute ( DriverCommand . SendKeysToElement , parameters ) ;
302307 }
0 commit comments