WebDriver / gets stuck on opening file download window
I am using my WebDriver with FireFox.
I have an element: // input [@ class = "uploadFiles"], when I click on it: driver.findElement (By.xpath ("// input [@ class =" uploadFiles "]")) the upload window opens file (Windows OS window), but the test doesn't continue until the next line, and get stuck.
Any help?
Webdriver does not interact with os level dialogs and that reason does not continue until next line. Does something help you here: http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_Does_WebDriver_support_file_uploads ?
No, you cannot do it with WebDriver like niharika_neo's answer, but you can do the following:
string filepath = "my local path";
_driver.FindElement(By.Id("attachments")).SendKeys(filepath);
_driver.FindElement(By.Id("attachments")).SendKeys(Keys.Return);
You cannot directly interact with the Windows OS layer. You can follow the path indicated by niharika_neo, or you can use the Auto IT tool to handle OS level windows. The best option is to use the Auto IT tool.
I faced the same problem with FF, then I found it to be specific to the FF version I am using. I have installed and tested tests on FF 11 and I was able to run its tests successfully. Try changing the FF version you are using.