← Back to team overview

sikuli-driver team mailing list archive

[Bug 1556195] Re: [1.1.0] Can't open app directly from IDE on OS X

 

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']
subprocess.Popen([cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()

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']
subprocess.Popen([cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()

In next step You can make switchApp
myApp=switchApp("Firefox")



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'
args=['sudo','-u',user,'osascript','-e','tell app "Firefox"\n activate\n end tell']
subprocess.Popen(args,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()

wait(2)
myApp=switchApp("Firefox")

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1556195

Title:
  [1.1.0] Can't open app directly from IDE on OS X

Status in Sikuli:
  In Progress

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("Firefox") commands.

  If I run this .sikuli file directly from command line
  "/Applications/SikuliX.app/run -r
  ~/Applications/SikuliX/scripts/firefox.sikuli/" - it works correctly.

  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.)

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1556195/+subscriptions


References