file - cucumber 文件下载确认

标签 file download cucumber confirmation

我有一个 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/

相关文章:

java - 在java中读取文件并打印最大和最小数

php - 将 MySQL 下载为 CSV 文件时出现问题

php - HTML 下载链接失败的可能原因是什么?

c# - 如何禁用下载提示,如 'do you want to open or save or save_as?'

ruby - 使用pry-rescue调试Cucumber步骤异常

ruby - 如何使用带有特定标签的 parallel_tests

linux - 解决断开的符号链接(symbolic link)

android - 在 Android 文件中旋转图像

python - Django 时间戳

java - 用于运行带有参数的 set maven 命令的 GUI?