可以打开FIle上传PopUp窗口

时间:2012-03-16 09:21:17

标签: selenium selenium-ide

我的页面有代码。

    <div class="qq-upload-button upload-img" style="position: relative; overflow: hidden; direction: ltr;">
    <input type="file" name="file" style="position: absolute; right: 0pt; top: 0pt; font-family: Arial; font-size: 118px; margin: 0pt; padding: 0pt; cursor: pointer; opacity: 0;">
    </div>

我想点击 qq-upload-button upload-img 我使用Click at css = .qq-upload-button输入,但它不起作用 如果我用我的手点击结果打开一个文件上传弹出窗口。 我怎么能在 Selenium IDE 中做到这一点? 谢谢提前!

2 个答案:

答案 0 :(得分:1)

你可以使用senKeys到上传输入字段,就像这样

 driver.findElement(By.name("file")).sendKeys("your file path");

不要在球场上打电话给.clear(),这不起作用。比继续(单击下一个按钮或提交类似的表单),您的文件将被上传。

答案 1 :(得分:0)

试试这个:

xpath=(//*[@class="qq-upload-button upload-img"])
相关问题