const robot = require('robotjs');
robot.keyTap('a');
// taps key 'a'
const robot = require('robotjs');
robot.keyTap('a');
// nothing happens
Still investigating
robot.keyTap('a');We're using this in our macOS and Windows desktop application to emit keyboard macros
Here's the output of npm test
> [email protected] test /Users/palette/Development/octalimage/robotjs
> run-script-os
> [email protected] test:darwin:linux /Users/palette/Development/octalimage/robotjs
> jasmine 'test/**/*.js'
Started
...FFFF.....FF......
Failures:
1) Integration/Keyboard types
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at ontimeout (timers.js:425:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
2) Integration/Mouse clicks
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at ontimeout (timers.js:425:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
3) Integration/Mouse scrolls vertically
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at ontimeout (timers.js:425:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
4) Integration/Mouse scrolls horizontally
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at ontimeout (timers.js:425:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
5) Mouse Move the mouse.
Message:
Expected false to be truthy.
Stack:
Error: Expected false to be truthy.
at UserContext.<anonymous> (/Users/palette/Development/octalimage/robotjs/test/mouse.js:20:34)
Message:
Expected false to be truthy.
Stack:
Error: Expected false to be truthy.
at UserContext.<anonymous> (/Users/palette/Development/octalimage/robotjs/test/mouse.js:21:34)
6) Mouse Move the mouse smoothly.
Message:
Expected 811 to equal 100.
Stack:
Error: Expected 811 to equal 100.
at UserContext.<anonymous> (/Users/palette/Development/octalimage/robotjs/test/mouse.js:42:26)
Message:
Expected 707 to equal 100.
Stack:
Error: Expected 707 to equal 100.
at UserContext.<anonymous> (/Users/palette/Development/octalimage/robotjs/test/mouse.js:43:26)
20 specs, 6 failures
Finished in 34.203 seconds
Current workaround is to downgrade Xcode 9 or Command Line tools to the 10.13 versions. Then Robot.js runs as before.
On Mojave the one needs the accessibility permission to send clicks.

On Mojave the one needs the accessibility permission to send clicks.
How to pop up the Accessibility Access dialog box?
@GJune it pops up automatically, just send some clicks with robotjs. I use it with Mocha for instance.
this worked for me!
open System Preferences > Security & Privacy > Accessibility (you might have to unlock the settings by clicking the lock icon in the bottom left hand corner) > check "Terminal" app in the list "Allow the apps below to control your computer"
@doodybrains I believe folks use robotjs on CI. This is impossible to do there.
@pronebird oh ok. this helped me for my own use of robotjs..thought it might be related.
Another potential insight: We were bundling robotjs in a ".app" and had to set the NSAppleEventsUsageDescription in Info.plist to get the accessibility permissions prompt.
This is no longer an issue for me; the maintainer(s) may close this if the CI issue (as noted by @doodybrains) cannot be addressed.
For me terminal was already checked. Unchecking and rechecking it did the trick! :)
It looks solved to me.
You may reopen this issue if it has been closed in error.
https://github.com/octalmage/robotjs/issues/548
Mouse stuff seems broken to me in Catalina.
For me terminal was already checked. Unchecking and rechecking it did the trick! :)
This is an issue I'm facing as well. If you deploy a new version of your app (I'm using Electron), even if the accessibility permission is already granted to the older version, it needs to be ungranted then granted again for robotjs to work.
This is annoying and there's no way to prompt the user to grant accessibility permissions again because they are already granted!
@oktapodia this looks like a macOS problem and not a robotjs problem I think, wdyt about this?
#535 seems to be the same issue.
Any word on fixing mouse support in catalina?
Most helpful comment
this worked for me!
open System Preferences > Security & Privacy > Accessibility (you might have to unlock the settings by clicking the lock icon in the bottom left hand corner) > check "Terminal" app in the list "Allow the apps below to control your computer"