SafariDriver send_keys to file input produces ElementNotVisibleException
Expected Behavior -
Whenever I try to upload a file using the send_keys method(path) method it works flawlessly with the chromedriver and firefox driver and uploads the file. When doing the exact same thing using the SafarDriver it produces an ElementNotVisibleException.
The HTML is as follows:
<input id="id" type="file" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" multiple="" accept="">
Actual Behavior -
Instead of uploading the file Selenium throws this exception: selenium.common.exceptions.ElementNotVisibleException: Message: InvalidStateError: DOM Exception 11 (WARNING: The server did not provide any stacktrace information)
Steps to reproduce -
Following code is used to upload the file
element = self.wait.until(EC.presence_of_element_located((method, locator)))
element.send_keys("/path/to/file.jpg")
I have also tried doing it using the file input on http://www.tinyupload.com. This gave me the same exception.
File uploads are not supported by Safari. It should report an unsupported operation error instead of element not visible.
Will this ever be supported? Do you have an alternative solution?
With the release of Safari 10, Apple now offers official support WebDriver. Because of this, the Selenium project no supports the legacy implementation from 2.x.
Users are advised to switch to Apple's driver and file bugs at https://bugreport.apple.com/
We are no longer tracking issues for Selenium's SafariDriver and thus closing this issue.