我有一个包含许多 webviews 的电子应用程序。我正在用 Spectron 测试它。我有像这样的加速器
- Cmd+ 放大
- Cmd- 缩小
- Cmdr 重新加载页面
我在这里读到 RobotJS 可以用于相同的用途。问题是
- RobotJS 无法识别 + 键、- 键等。
- 我按照这个和这个链接使 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`).
我尝试使用此 stackoverflow 链接来修复上述版本问题,但无济于事。
我也尝试使用webdriver 密钥,但没有效果。我没有收到任何错误,但在运行集成测试时没有任何反应。
更新:
- 我在 RobotJS repo 上打开了一个Github 问题。