我有一个 cucumber 步骤,用于下载文件,但我无法使用 cucumber 步骤单击浏览器提供的对话框中的“保存”按钮。
我找到了一些解决类似问题的页面,但它没有解决我的问题
How to test a confirm dialog with Cucumber?
我已经包含了这个用于文件下载的 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
但没有成功。
谢谢
最佳答案
您尝试过 page.driver 语法吗?
即来自:How to test a confirm dialog with Cuccumber? :
When /^I confirm popup$/ do
page.driver.browser.switch_to.alert.accept
end
When /^I dismiss popup$/ do
page.driver.browser.switch_to.alert.dismiss
end
伊恩。
关于file - cucumber 文件下载确认,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4624389/