测试电子全局快捷方式加速器

问题描述

我有一个包含许多网络视图的电子应用程序。我正在用 Spectron 测试它。我有

这样的加速器
  • Cmd+ 放大
  • Cmd- 缩小
  • Cmdr 重新加载页面

我读到 here 可以使用 RobotJS。问题是

  1. RobotJS 无法识别 + 键、- 键等。
  2. 我按照 thisthis 链接让 RobotJS 与电子一起工作。我的电子版是 11.4.5。所以我跑了npm rebuild --runtime=electron --target=11.4.5 --disturl=https://atom.io/download/atom-shell --abi=67。当我运行测试时,我得到
The module '/Users/.../node_modules/robotjs/build/Release/robotjs.node'was compiled against a different Node.js version using
NODE_MODULE_VERSION 85. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing the module (for instance,using `npm rebuild` or `npm install`).

我尝试使用 this stackoverflow link 解决上述版本问题,但无济于事。

我也试过使用 webdriver keys 但没有效果。我没有收到任何错误,但在运行集成测试时没有任何反应。

更新:

  1. 我在 RobotJS 存储库上打开了一个 Github issue

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)