繁体   English   中英

WebDriverException:消息:找不到文件-关闭Robot Framework中的Upload 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM