selenium icon indicating copy to clipboard operation
selenium copied to clipboard

SafariDriver send_keys to file input produces ElementNotVisibleException

Open remcowesterhoud opened this issue 10 years ago • 3 comments

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.

remcowesterhoud avatar Feb 22 '16 16:02 remcowesterhoud

File uploads are not supported by Safari. It should report an unsupported operation error instead of element not visible.

jleyba avatar Mar 01 '16 22:03 jleyba

Will this ever be supported? Do you have an alternative solution?

mstankovic86 avatar Mar 15 '16 11:03 mstankovic86

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.

lukeis avatar Sep 23 '16 20:09 lukeis