I am trying to upload file to Safari(8.0.8) using webdriver. Can anyone confirm it is possible or not? I was searching this problem and I cant find clear information.
My test environment: I run test at my local PC with Win7 and browser start at Selenium Grid which is running on MAC machine (hub + node run at MAC Yosemite 10.10.5)
First, I try to upload direct file on MAC. But it is not working.
Browser.Driver.FindElement(By.Id("inputID")).SendKeys("/Users/administrator/Desktop/file.txt");
Next, I try to use LocalFileDetetor but it also doesn't work:
driver.FileDetector = new LocalFileDetector();
Browser.Driver.FindElement(By.Id("inputID")).SendKeys("c:\\file.txt");
Next, I try to use: WebDriverBackedSelenium:
ISelenium safari = new WebDriverBackedSelenium(webDriver, "http://systemname/");
safari.Start();
safari.AttachFile("xpath=//input[@id='inputID']", "e:\\file2.txt");
But it doesn't work too. Stack trace:
Selenium.SeleniumException : WebDriver exception thrown ----> OpenQA.Selenium.InvalidElementStateException : Element must be user-editable in order to clear it. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 7 milliseconds Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16' System info: host: 'mac.domain.company.com', ip: '192.168.136.67', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_51' Driver info: org.openqa.selenium.safari.SafariDriver Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=8.0.8, cssSelectorsEnabled=true, platform=MAC, secureSsl=true}] Session ID: null
It doesn't work because it is Safari or there is problem with grid/safari/remote host or with file path(something with / )?