开发者

how to upload a file using firefoxdriver in selenium testing

开发者 https://www.devze.com 2023-03-20 20:54 出处:网络
i want to upload a gif file in my application using selenium codes in firefox, i have the following file input type:

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开发者_如何学Python a file upload window is opening, can any one help me getting out of it.please

thank you


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();

0

精彩评论

暂无评论...
验证码 换一张
取 消