4

While trying to run automated tests on BrowserStack to test a webpage on IE11 and Safari, I'm unable to upload a document from the test-running assembly.

I have the following code:

var uploadFile = driver.FindElement(By.CssSelector("..."));
driver.FileDetector = new LocalFileDetector();
uploadFile.SendKeys(myLocalPath);

This code works in all other browser-platform combinations except IE11 and Safari.

If I capture a screenshot immediately after the above code, it shows that the <input type="file"> element is empty, whereas other browsers show the value of the myLocalPath variable.

I know that it does find the upload element; my suspicion is that the SendKeys method is either not working correctly on IE11/Safari and/or some security measure is preventing the text (myLocalPath) from being inserted.

Has anyone else come across this problem and found a solution?

awj
  • 6,501
  • 8
  • 54
  • 98
  • Sounds like it could be similar to this (unresolved) bug report: https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3858 – Josh Jul 29 '16 at 13:16
  • If you included a URL, it's not showing up in the published version of your comment. – awj Jul 29 '16 at 13:18
  • 1
    Weird... try again! https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3858 – Josh Jul 29 '16 at 13:18

0 Answers0