3
我必須包括點擊瀏覽按鈕,並從本地驅動器中選擇一張圖片。可以使用Selenium IDE完成嗎?如何使用Selenium IDE附加圖片?
我必須包括點擊瀏覽按鈕,並從本地驅動器中選擇一張圖片。可以使用Selenium IDE完成嗎?如何使用Selenium IDE附加圖片?
首先得到例如文件上傳部分的ID(請注意,我假設有一個提交按鈕,其ID是Btn_Click上單擊該文件將得到上傳的解決方案。)
<input type="file" name="abc" class="input" size="15" id="xyz"/>
那麼你的硒測試用例會像下面
<tr>
<td>open</td>
<td>/Your page where to upload file</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=xyz</td>
<td>/path of your file to be uploaded</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>css=btn_click</td>
<td></td>
</tr>
http://stackoverflow.com/questions/8141526/how-do-you-upload-a-file-using-selenium-ide和http:/ /stackoverflow.com/questions/9718382/script-to-upload-a-file-in-selenium-ide可能會有所幫助。 – olyv 2014-09-04 07:21:36