Selenium WebDriverException:消息:未找到文件-关闭Robot框架中的上载文件窗口

Selenium WebDriverException:消息:未找到文件-关闭Robot框架中的上载文件窗口,selenium,selenium-webdriver,robotframework,selenium2library,Selenium,Selenium Webdriver,Robotframework,Selenium2library,我需要关闭浏览器的文件上载窗口。我尝试了以下代码来实现这一点 按键id=fileToUpload\\27-我在URL中找到了ascii字符 我的完整代码是 *** Variables *** ${TVAURL} http://localhost:1500/ ${Browser} Firefox TC_01: Enter into the application [Documentation] Enter into the application to upload a

我需要关闭浏览器的文件上载窗口。我尝试了以下代码来实现这一点

按键id=fileToUpload\\27
-我在URL中找到了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代码是


上载文件
选择要上载的图像:


上传文件后,您需要单击网站上的“提交”按钮,不要使用错误的定位器再次上传文件

<input type="submit" value="Upload Image" name="submit">

将最后一行更改为:

按键id=fileToUpload

按键名称=提交


这应该可以满足您的需要。

请提及您的测试床。@demouser123文件上传后,我需要关闭“不提交”按钮单击事件窗口。您的测试床表示您的系统配置-您的Selenium,FF版本是什么?我想你用来逃跑的
\\27
在这里不起作用。此外,只有当您提交文件进行上传时,文件才会被上传,即当您按Enter键或单击OK按钮时。为什么要按Esc键而不是按Enter键。@demouser123-是的,我正在尝试按Enter键escape@demouser123-Selenium版本为3.4.3,Firefox版本为53.0.3(32位)在按下submit按钮之前,我需要关闭窗口。如果您想使用selenium执行此操作,那么您的操作方式是错误的…请查看此操作,您不应该打开OS文件上载。如果您将文件路径发送到相应的定位器,Selenium将为您执行此操作。如果您需要与操作系统交互,那么您需要一个不同的工具,如AUTOIT,您需要从脚本中调用它。希望这有帮助。