Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on new macOS 10.14 Mojave #424

Closed
nfrasser opened this issue Sep 25, 2018 · 15 comments
Closed

Not working on new macOS 10.14 Mojave #424

nfrasser opened this issue Sep 25, 2018 · 15 comments

Comments

@nfrasser
Copy link

Expected Behavior

const robot = require('robotjs');
robot.keyTap('a');
// taps key 'a'

Current Behavior

const robot = require('robotjs');
robot.keyTap('a');
// nothing happens

Possible Solution

Still investigating

Steps to Reproduce (for bugs)

  1. Use a Mac running macOS 10.14
  2. Try running robot.keyTap('a');

Context

We're using this in our macOS and Windows desktop application to emit keyboard macros

Your Environment

  • RobotJS version: 0.5.1
  • Node.js version: 10.11.0
  • npm version: 6.4.1
  • Operating System: macOS 10.14
@nfrasser
Copy link
Author

Here's the output of npm test

> robotjs@0.5.1 test /Users/palette/Development/octalimage/robotjs
> run-script-os


> robotjs@0.5.1 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

@nfrasser
Copy link
Author

Current workaround is to downgrade Xcode 9 or Command Line tools to the 10.13 versions. Then Robot.js runs as before.

@pronebird
Copy link

On Mojave the one needs the accessibility permission to send clicks.

screenshot 2018-10-10 at 13 16 03

@GJune
Copy link

GJune commented Nov 20, 2018

On Mojave the one needs the accessibility permission to send clicks.

screenshot 2018-10-10 at 13 16 03

How to pop up the Accessibility Access dialog box?

@pronebird
Copy link

pronebird commented Nov 20, 2018

@GJune it pops up automatically, just send some clicks with robotjs. I use it with Mocha for instance.

@doodybrains
Copy link

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"

@pronebird
Copy link

@doodybrains I believe folks use robotjs on CI. This is impossible to do there.

@doodybrains
Copy link

@pronebird oh ok. this helped me for my own use of robotjs..thought it might be related.

@nfrasser
Copy link
Author

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.

@sancarn
Copy link

sancarn commented Sep 30, 2019

For me terminal was already checked. Unchecking and rechecking it did the trick! :)

@oktapodia
Copy link
Collaborator

It looks solved to me.
You may reopen this issue if it has been closed in error.

@brandonros
Copy link

#548

Mouse stuff seems broken to me in Catalina.

@aabuhijleh
Copy link

aabuhijleh commented Mar 8, 2020

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.

@greggreenhaw
Copy link

Any word on fixing mouse support in catalina?

@xiajingren
Copy link

macOS Monterey 12.3.1

Robotjs works perfectly in dev - does nothing in production, any news ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants