问题描述
我需要关闭浏览器的文件上传"窗口.我尝试了以下代码来实现
I need to close the File Upload window of a browser. I tried the following code to achieve this
Press Key id=fileToUpload \\27
-我在URL http://help.adobe.com/zh_CN/AS2LCR/Flash_10.0/help.html?content=00000520.html
我的完整代码是
*** 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代码是
My respective sample HTML code is
<!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
It gives the error message WebDriverException: Message: File not found : //27
文件上传后(即Choose File
命令旁边),我需要关闭浏览器的文件上传器窗口
I need to close the file uploader window of a browser, once the file gets uploaded (i.e., next to the Choose File
command)
推荐答案
上传文件后,需要单击网站上的提交"按钮,而不要使用错误的定位器再次上传文件.
Once you upload the file you need to click the submit button on the website and not uploadfile again with the wrong locator..
<input type="submit" value="Upload Image" name="submit">
从以下位置更改您的最后一行:
Change your last line from:
按键ID = fileToUpload
Press Key id=fileToUpload
to
按键名称=提交
那应该为你做.
这篇关于WebDriverException:消息:找不到文件-关闭Robot Framework中的Upload File窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!