1

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
1
  • 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. Commented Sep 21, 2011 at 15:16

1 Answer 1

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.