i want to upload a gif file in my application using selenium codes in firefox, i have the following file input type:
<input id="file" type="file" size="27" value="Attach document" onclick="javascript:return processAttachment();" name="file">
i have tried this code:
driver.findElementByName("file").sendKeys("E:/plus.GIF");
driver.findElementByName("file").click();
but its is not working, instead a file upload window is opening, can any one help me getting out of it.please
thank you
asked Jul 18, 2011 at 12:26
-
The answer is in the html you provided; the onclick event in the element causes some javascript to open the file upload window, and your code is clicking on the element causing the onclick event.Anders– Anders2011年09月21日 15:16:12 +00:00Commented Sep 21, 2011 at 15:16
1 Answer 1
With this line driver.findElementByName("file").click(); you are "trying" to click the field , where you typed the text.It should be driver.findElementByName("NAME OF THE SUBMIT BUTTON").click();
answered Nov 2, 2011 at 14:14
Sign up to request clarification or add additional context in comments.
Comments
Explore related questions
See similar questions with these tags.