![](/img/trans.png)
[英]selenium.common.exceptions.WebDriverException: Message: File not found: /path/to/file
[英]WebDriverException: Message: File not found - Close Upload FIle window in Robot Framework
我需要關閉瀏覽器的“文件上傳”窗口。 我嘗試了以下代碼來實現這一目標
Press Key id=fileToUpload \\\\27
我在URL http://help.adobe.com/zh_CN/AS2LCR/Flash_10.0/help.html?content=00000520.html中找到了ascii字符
我的完整代碼是
*** Variables ***
${TVAURL} http://localhost:1500/
${Browser} Firefox
TC_01: Enter into the application
[Documentation] Enter into the application to upload a file
Open Browser ${TVAURL} ${Browser}
Choose File id=fileToUpload C://Downloads/Demo/rose.png
Press Key id=fileToUpload \\27
我各自的示例HTML代碼是
<!DOCTYPE html> <html> <head> <title>Upload File</title> </head> <body> <form action="upload.php" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <br/> <input type="submit" value="Upload Image" name="submit"> </form> </body> </html>
它給出錯誤消息WebDriverException: Message: File not found : //27
文件上傳后,我需要關閉瀏覽器的文件上傳器窗口(即,在“ Choose File
命令旁邊)
上傳文件后,您需要單擊網站上的提交按鈕,而不是使用錯誤的定位器再次上傳文件。
<input type="submit" value="Upload Image" name="submit">
將您的最后一行從:
按鍵id = fileToUpload
至
按鍵名稱=提交
那應該為你做。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.