sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #37784
Re: [Question #292399]: [1.1.0] Sikuli App object throws java.lang.ArrayIndexOutOfBoundsException
Question #292399 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/292399
Status: Needs information => Open
midwesthawkeye gave more information on the question:
Interesting. I edited the script as you suggested...
from sikuli.Sikuli import *
# Above: using import because I eventually want to build a callable routine in here that does this,
# and call is from variuous scripts to launch Chrome, and hav it ready to have a URL typed in.
# App to work with is Google Chrome
browsername = "Google Chrome"
# First see if a previous session of Chrome is open. If so, close it.
myBrowser = App(browsername)
if myBrowser.window() :
myBrowser.close()
# Now launch a fresh Chrome session.
myBrowser.open()
wait(3)
Works reliably if Google Chrome is not already open. Here is the
terminal window as it WORKS!
labmac:sikuliScripts macuser$ runsikulix -d 3 -c -r launchChrome.sikuli
running SikuliX: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/sikulix.jar -d 3 -c -r launchChrome.sikuli
[debug] RunTimeINIT: loadOptions: check: /Users/macuser/code/pythonProjects/reaper/sikuliScripts
[debug] RunTimeINIT: loadOptions: check: /Users/macuser
[debug] RunTimeINIT: loadOptions: check: /Users/macuser/Library/Application Support/Sikulix/SikulixStore
[debug] RunTimeINIT: global init: entering as: IDE
[debug] RunTimeINIT: ScreenDevice 0 has (0,0) --- will be primary Screen(0)
[debug] RunTimeINIT: Monitor 0: (0, 0) 1680 x 1050
[debug] RunTimeINIT: runs as sikulix.jar in: /Users/macuser/Sikulix/SikuliX.app/Contents/Java
[debug] RunTimeINIT: exists libs folder at: /Users/macuser/Library/Application Support/Sikulix/SikulixLibs_201603300100
***** show environment for IDE (build 201603300100)
user.home: /Users/macuser
user.dir (work dir): /Users/macuser/code/pythonProjects/reaper/sikuliScripts
user.name: macuser
java.io.tmpdir: /var/folders/bj/6z20hv1156j1qq2_v64vzvw80000gn/T
running 64Bit on Mac OSX (10.11.4) as application .app (not from /Applications folder)
java 8-64 version 1.8.0_91-b14 vm 25.91-b14 class 52.0 arch x86_64
app data folder: /Users/macuser/Library/Application Support/Sikulix
libs folder: /Users/macuser/Library/Application Support/Sikulix/SikulixLibs_201603300100
executing jar: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/sikulix.jar
*** classpath dump sikulix
0: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/sikulix.jar
*** classpath dump end
***** show environment end
[debug] RunTimeIDE: global init: leaving
[debug] RunTimeIDE: initIDEbefore: entering
[debug] RunTimeIDE: initIDEbefore: leaving
[debug] RunTimeIDE: initAPI: entering
[debug] RunTimeIDE: initAPI: leaving
[debug] init user preferences
[debug] IDE: running with Locale: en_US
[debug] IDE: initNativeSupport: starting
[debug] IDE: initNativeSupport: success
[debug] IDE: Switching to ScriptRunner with option -r, -t or -i
[debug] Runner: commandline: -d 3 -c -r launchChrome.sikuli
[debug] --- Sikuli parameters ---
[debug] 1: -d
[debug] 2: 3
[debug] 3: -c
[debug] 4: -r
[debug] 5: launchChrome.sikuli
[debug] ScriptingSupport: givenScriptName:
launchChrome.sikuli
[debug] ScriptingSupport: Trying to run script:
/Users/macuser/code/pythonProjects/reaper/sikuliScripts/launchChrome.sikuli/launchChrome.py
[debug] ScriptingSupport: initScriptingSupport: enter
[debug] JythonSupport: init: starting
[debug] JythonSupport: init: success
[debug] JythonSupport: ***** Jython sys.path
0: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/Lib
1: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/sikulix.jar/Lib
2: __classpath__
3: __pyclasspath__/
[debug] JythonSupport: ***** Jython sys.path end
[debug] Jython: sikuli: Sikuli: starting init
[debug] RunTimeIDE: loadLib: libVisionProxy.dylib
[debug] Mouse: init
[debug] KeyBoard: init
[debug] RunTimeIDE: loadLib: libMacUtil.dylib
[debug] Jython: requested to use as default region: R[0,0 1680x1050]@S(0)
[debug] Jython: sikuli: Sikuli: ending init
[debug] JythonScriptRunner: running Jython 2.7.0
[debug] ScriptingSupport: initScriptingSupport: added: jython
[debug] ScriptingSupport: initScriptingSupport: exit with defaultrunner: jython (py)
[debug] ImagePath: new BundlePath:
/Users/macuser/code/pythonProjects/reaper/sikuliScripts/launchChrome.sikuli/
[debug] Jython: requested to use as default region: R[0,0 1680x1050]@S(0)
[debug] JythonScriptRunner: runPython: running script:
/Users/macuser/code/pythonProjects/reaper/sikuliScripts/launchChrome.sikuli
[debug] App.create: [-1:Google Chrome]
[debug] App.open [659:Google Chrome]
[debug] RunTimeIDE: final cleanup
[debug] FileManager: deleteFileOrFolder:
/var/folders/bj/6z20hv1156j1qq2_v64vzvw80000gn/T/Sikulix_334681089
labmac:sikuliScripts macuser$
However, if Google Chrome is already opened, it often fails (but not
ALWAYS) like this...
labmac:sikuliScripts macuser$ runsikulix -d 3 -c -r launchChrome.sikuli
running SikuliX: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/sikulix.jar -d 3 -c -r launchChrome.sikuli
[debug] RunTimeINIT: loadOptions: check: /Users/macuser/code/pythonProjects/reaper/sikuliScripts
[debug] RunTimeINIT: loadOptions: check: /Users/macuser
[debug] RunTimeINIT: loadOptions: check: /Users/macuser/Library/Application Support/Sikulix/SikulixStore
[debug] RunTimeINIT: global init: entering as: IDE
[debug] RunTimeINIT: ScreenDevice 0 has (0,0) --- will be primary Screen(0)
[debug] RunTimeINIT: Monitor 0: (0, 0) 1680 x 1050
[debug] RunTimeINIT: runs as sikulix.jar in: /Users/macuser/Sikulix/SikuliX.app/Contents/Java
[debug] RunTimeINIT: exists libs folder at: /Users/macuser/Library/Application Support/Sikulix/SikulixLibs_201603300100
***** show environment for IDE (build 201603300100)
user.home: /Users/macuser
user.dir (work dir): /Users/macuser/code/pythonProjects/reaper/sikuliScripts
user.name: macuser
java.io.tmpdir: /var/folders/bj/6z20hv1156j1qq2_v64vzvw80000gn/T
running 64Bit on Mac OSX (10.11.4) as application .app (not from /Applications folder)
java 8-64 version 1.8.0_91-b14 vm 25.91-b14 class 52.0 arch x86_64
app data folder: /Users/macuser/Library/Application Support/Sikulix
libs folder: /Users/macuser/Library/Application Support/Sikulix/SikulixLibs_201603300100
executing jar: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/sikulix.jar
*** classpath dump sikulix
0: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/sikulix.jar
*** classpath dump end
***** show environment end
[debug] RunTimeIDE: global init: leaving
[debug] RunTimeIDE: initIDEbefore: entering
[debug] RunTimeIDE: initIDEbefore: leaving
[debug] RunTimeIDE: initAPI: entering
[debug] RunTimeIDE: initAPI: leaving
[debug] init user preferences
[debug] IDE: running with Locale: en_US
[debug] IDE: initNativeSupport: starting
[debug] IDE: initNativeSupport: success
[debug] IDE: Switching to ScriptRunner with option -r, -t or -i
[debug] Runner: commandline: -d 3 -c -r launchChrome.sikuli
[debug] --- Sikuli parameters ---
[debug] 1: -d
[debug] 2: 3
[debug] 3: -c
[debug] 4: -r
[debug] 5: launchChrome.sikuli
[debug] ScriptingSupport: givenScriptName:
launchChrome.sikuli
[debug] ScriptingSupport: Trying to run script:
/Users/macuser/code/pythonProjects/reaper/sikuliScripts/launchChrome.sikuli/launchChrome.py
[debug] ScriptingSupport: initScriptingSupport: enter
[debug] JythonSupport: init: starting
[debug] JythonSupport: init: success
[debug] JythonSupport: ***** Jython sys.path
0: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/Lib
1: /Users/macuser/Sikulix/SikuliX.app/Contents/Java/sikulix.jar/Lib
2: __classpath__
3: __pyclasspath__/
[debug] JythonSupport: ***** Jython sys.path end
[debug] Jython: sikuli: Sikuli: starting init
[debug] RunTimeIDE: loadLib: libVisionProxy.dylib
[debug] Mouse: init
[debug] KeyBoard: init
[debug] RunTimeIDE: loadLib: libMacUtil.dylib
[debug] Jython: requested to use as default region: R[0,0 1680x1050]@S(0)
[debug] Jython: sikuli: Sikuli: ending init
[debug] JythonScriptRunner: running Jython 2.7.0
[debug] ScriptingSupport: initScriptingSupport: added: jython
[debug] ScriptingSupport: initScriptingSupport: exit with defaultrunner: jython (py)
[debug] ImagePath: new BundlePath:
/Users/macuser/code/pythonProjects/reaper/sikuliScripts/launchChrome.sikuli/
[debug] Jython: requested to use as default region: R[0,0 1680x1050]@S(0)
[debug] JythonScriptRunner: runPython: running script:
/Users/macuser/code/pythonProjects/reaper/sikuliScripts/launchChrome.sikuli
[debug] App.create: [755:Google Chrome]
[debug] App.close: [755:Google Chrome]
[error] App.open failed: Google Chrome not found
[debug] RunTimeIDE: final cleanup
[debug] FileManager: deleteFileOrFolder:
/var/folders/bj/6z20hv1156j1qq2_v64vzvw80000gn/T/Sikulix_1017752462
labmac:sikuliScripts macuser$
Should I maybe put a wait() in to allow Google Chrome more time to fully
close? I mean the goal here is for the script to check if there is a
left over Chrome session hanging out there, and get rid of it before
starting with a new one.
BTW - THANKS SO MUCH!!! for helping out here.
--> Jake
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.