[1.1.0] Can't open app directly from IDE on OS X
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SikuliX |
In Progress
|
High
|
RaiMan |
Bug Description
Environment:
OS X 10.11.3
SikuliX IDE 1.1.0 Build 2015-10-05_17:07
JDK 8u73
When I run .sikuli script directly from SikuliX IDE opened app immediately exits
For example, script contains:
myApp = App("Firefox")
myApp.open()
When I try to run the script from IDE I can see Firefox app's icon blinks for a second in Dock and then disappears. The same happens with openApp("Firefox") or switchApp(
If I run this .sikuli file directly from command line "/Applications/
The issue doesn't reproduce with common OS X apps (I tried Safari, TextEdit, Terminal, Calculator etc.).
But it reproduces with non-common OS X apps (I tried FireFox, TextWrangler, Microsoft Word etc.)
Changed in sikuli: | |
status: | New → In Progress |
importance: | Undecided → Medium |
assignee: | nobody → RaiMan (raimund-hocke) |
milestone: | none → 1.1.1 |
Hi
It is problem in new El-Captain version.
Sikuli run Application using osascript:
osascript -e 'tell app "Application" to activate'
It working from terminal, but not from python subprocess
cmd=['osascript ','-e', 'tell app "Firefox" to activate'] Popen([ cmd,stdout= subprocess. PIPE,stderr= subprocess. PIPE).communica te()
subprocess.
It is becouse it is running not as logged user, and don't have acces to GUI.
It can be fixed adding "sudo"
cmd=['sudo' ,'-u',' LoggedUserName' ,'osascript' ,'-e',' tell app "Firefox" to activate'] Popen([ cmd,stdout= subprocess. PIPE,stderr= subprocess. PIPE).communica te()
subprocess.
In next step You can make switchApp ("Firefox" )
myApp=switchApp
args=[' sudo',' -u',user, 'osascript' ,'-e',' tell app "Firefox"\n activate\n end tell']
It is problem with the user who run firefox it is not You, and he don't access to gui components.
You must add "sudo"
user='YourName' sudo',' -u',user, 'osascript' ,'-e',' tell app "Firefox"\n activate\n end tell'] Popen(args, stdout= subprocess. PIPE,stderr= subprocess. PIPE).communica te()
args=['
subprocess.
wait(2) ("Firefox" )
myApp=switchApp