I have a Jenkins config that executes Java tests for OS X app using Maven. And when I'm trying to run some AppleScript that requires assistive access for it, different errors appear. So I've tried to execute AppleScript in two ways:
Using ScriptEngine:
ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("AppleScriptEngine"); engine.eval(script);
In this case script execution fails with error: An error of type -10810 has occurred.
In accessibility list I have following things: SystemUIServer, Script Editor, osascript, java, mvn, bash, Terminal. When running script in Script Editor or in osascript from Terminal, script passed without any errors.
Any suggestions what else should I check?
I think you answer your own question. You can allow assistive access for Script Editor (among other things). It works fine in Script Editor.
You can try and add other applications to have assistive access. This might be an option if Script Editor does not give you want you want.