【发布时间】:2014-06-10 05:21:45
【问题描述】:
我正在尝试使用 Capybara 脚本上传文件。我从以下链接获得了一些帮助,我正在尝试使用以下链接中指定的 autoIT 选项:
Testing HTML5 File Upload with Capybara/Selenium Webdriver - Ruby
在上面的页面中,我对以下两行有疑问:
find_field(<<upload_file_id>>).click
system("<<full_path>>\\file_upload.exe \"#{<<file_path>>}\" \"File Upload\"")
感谢脚本,我用给定的代码创建了一个 .exe,并给出了上面两行以上传文件,但它给出了语法错误。
上述语法中的“文件上传”是什么?这是我要上传的文件的名称吗?我尝试了很多方法(正/反斜杠),但它返回Syntax error (syntax error, unexpected keyword_end, expecting ')' (SyntaxError))。这是我的语法。请建议并让我知道我缺少什么。赞赏这方面的建议。任何在语法中具有特定文件名的示例都会有帮助。
system("C:/Cucumber/cucumberdemo/features/file_upload.exe/"#
{C:/Cucumber/cucumberdemo/Capybara.PNG}\"\File Upload\"")
system("C:\Cucumber\cucumberdemo\features\file_upload.exe\"#
{C:\Cucumber\cucumberdemo}\"\"Capybara.PNG\"")
system("C:/Cucumber/cucumberdemo/features//file_upload.exe/"#
{C:/Cucumber/cucumberdemo}/"/"Capybara.PNG/"")
system("C:/Cucumber/cucumberdemo/features/file_upload.exe/"#
{C:/Cucumber/cucumberdemo/Capybara.PNG}/"")
另外,System 命令是否也会单击对话框中的“打开”按钮,还是我需要为此编写单独的脚本?
【问题讨论】:
标签: file-upload capybara autoit