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?