0

我还没有找到相关的api。

我要点击“确定”

在此处输入图像描述

4

1 回答 1

1

我意识到这是一个老问题,但为了后代和完整性,能够覆盖 , 的默认行为inputconfirm并通过定义自定义预加载脚本alert在 v2.1.0 中添加。

我假设这是一个确认提示,而您想要的选择是肯定的。默认情况下,Nightmare 现在将使用确认指定的默认响应。如果您想覆盖该行为,您可以执行以下操作:

window.__nightmare = {};
__nightmare.ipc = require('ipc');
window.confirm = function(message, defaultResponse){
  if(message == "sure to delete?")
       return true;
  return defaultResponse;
}

...在自定义预加载文件中。

于 2016-02-03T19:47:17.027 回答