黄瓜文件下载确认
我有一个黄瓜步骤,可以下载文件,但我无法使用黄瓜步骤单击浏览器提供的对话框中的“保存”按钮。
我找到了一些解决类似问题的页面,但它没有解决我的
我已包含此 Cucumber 步骤用于文件下载
When /^I confirm a js popup on the next step$/ do
page.evaluate_script("window.alert = function(msg) { return true; }")
page.evaluate_script("window.confirm = function(msg) { return true; }")
end
,但不起作用。
谢谢
I have a cucumber step where the file gets downloaded, but i am unable to click the save button in the dialog box that a browser provides, with cucumber step.
I have found some pages which solves the similar kind of problems, but it didn't solve mine
How to test a confirm dialog with Cucumber?
I have included this cucumber step for file download
When /^I confirm a js popup on the next step$/ do
page.evaluate_script("window.alert = function(msg) { return true; }")
page.evaluate_script("window.confirm = function(msg) { return true; }")
end
But didn't work.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您尝试过 page.driver 语法吗?
即,来自: 如何使用 Cucumber 测试确认对话框? :
伊恩。
Did you try the page.driver syntax?
i.e., from: How to test a confirm dialog with Cuccumber?:
ian.
我知道这已经很旧了,但由于这是我在寻找解决方案时遇到的第一个 SO 帖子之一,我想我应该发布一个解决方案。
我们可以使用好的 ol Ruby 以及 open-uri(因此,如果您尚未使用 open-uri,请在 Gemfile 中包含它):
I know this is old, but since this was one of the first SO posts I came across when searching for solutions, I figured I'd post a solution.
We can use good ol Ruby, along with open-uri (so include open-uri in your Gemfile if you aren't already using it):