When I tried taking screenshoot, the screen turned black. I use Ubuntu 18.04 on Dell laptop without any other monitor attached.

Asked by Rakha Fauzan on 2020-06-17

Hi.

When I tried taking screenshoot, the screen turned black. I use Ubuntu 18.04 on Dell laptop without any other monitor attached. I use openJDK 11.

I tried to follow question 127102 (https://answers.launchpad.net/sikuli/+question/127102)
and using the script in comment #3.

the message result is like this:

java.awt.Rectangle[x=0,y=0,width=1920,height=1080]
[error] Screen(1) not in valid range 0 to 0 - using primary 0
java.awt.Rectangle[x=0,y=0,width=1920,height=1080]
------ hover test s0
L[100,100]@S(0)
left and laptop

------ hover test s1
L[100,100]@S(0)
left and laptop

------ capture test s0
black
------ capture test s1
black
------ selectRegion test s0
None
L[466,405]@S(0)
------ click test s0
L[966,545]@S(0)
------ click test s1
L[955,580]@S(0)

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-06-23
Last reply:
2020-06-24
RaiMan (raimund-hocke) said : #1

what version of SikuliX?

the script/program code you are using?

Rakha Fauzan (rakhafzn) said : #2

SikuliX 2.0.4, the latest stable version I downloaded from https://raiman.github.io/SikuliX1/downloads.html , and I have follow the instruction to download the jython and put it in the same folder as the sikulix ide

well I only tried using the script from the comment #9 from question 127102 ( https://answers.launchpad.net/sikuli/+question/127102 ), it runs well, but still when I tried taking screenshoot it turned black ( https://drive.google.com/file/d/1I0HVoHH7rBmrbpgBemvLW07wrnzZuUcT/view?usp=sharing )

Rakha Fauzan (rakhafzn) said : #3

sorry, I should have pate the script from the start

setShowActions(True)
s0 = Screen(0).getBounds()
print s0
s1 = Screen(1).getBounds()
print s1
print "------ hover test s0"
popup("A crosshair will be displayed in upper left corner of Screen(0). Remember the monitor!")
hover(Location(s0.x+100, s0.y+100))
print Env.getMouseLocation()
print input("fill in the combination: left or right (monitor) and laptop or external (monitor)")
print input("fill in yes, if this monitor has the Windows taskbar, otherwise just klick ok")
print "------ hover test s1"
popup("A crosshair will be displayed in upper left corner of Screen(1). Remember the monitor!")
hover(Location(s1.x+100, s1.y+100))
print Env.getMouseLocation()
print input("fill in the combination: left or right (Monitor) and Laptop or External (Monitor)")
print input("fill in yes, if this monitor has the Windows taskbar, otherwise just klick ok")
print "------ capture test s0"
popup("now we try to capture the upper left corner (0,0,300,300) of Screen(0)")
img = capture(s0.x, s0.y, 300, 300)
print input("Now check the content of image file\n"+img+"\nand fill in black if this is the fact, otherwise click ok")
print "------ capture test s1"
popup("now we try to capture the upper left corner (0,0,300,300) of Screen(1)")
img = capture(s1.x, s1.y, 300, 300)
print input("Now check the content of image file\n"+img+"\nand fill in black if this is the fact, otherwise click ok")
print "------ selectRegion test s0"
popup("now you will try to select a region on Screen(0). \nIf the monitor turns black, move the mouse pointer to Screen(0) and just click right or left mouse button to cancel.\nclick OK to proceed")
r0 = selectRegion("select a Region on Screen(0)")
print r0
print Env.getMouseLocation()
if r0:
   print "------ selectRegion test s1"
   popup("now the same for Screen(1)")
   print selectRegion("select a Region on Screen(0)")
   print Env.getMouseLocation()
print "------ click test s0"
popup("after clicking OK, click somewhere in the middle of Screen(0) within 5 seconds and don't move the mouse afterwards")
wait(6)
print Env.getMouseLocation()
print "------ click test s1"
popup("after clicking OK, click somewhere in the middle of Screen(1) within 5 seconds and don't move the mouse afterwards")
wait(6)
print Env.getMouseLocation()
popup("This ends the test. The results are shown in the message area")

Rakha Fauzan (rakhafzn) said : #4

Any update on this? I tried to delete the sikuli ide jar and delete .SikuliX folder, downloaded the ide again, but nothing changed.

Rakha Fauzan (rakhafzn) said : #5

This is the message appearing in my terminal when I use the command java -jar SikuliX/sikulixide-2.0.4.jar -c -v

[DEBUG]startUp: IDE: Running: /home/administrator/SikuliX/sikulixide-2.0.4.jar
[DEBUG]startUp: IDE: AppData: /home/administrator/.Sikulix
[DEBUG]startUp: IDE: starting with classpath: SikuliX/sikulixide-2.0.4.jar ...
[DEBUG]startUp: IDE: no extensions.txt nor valid content
[DEBUG]startUp: IDE: adding extension file: /home/administrator/.Sikulix/Extensions/jython-standalone-2.7.1.jar
[204 debug] RunTime:temp folder ok: /tmp/Sikulix_499215818
Options: *** options dump
Options: testing =
Options: OptionsFile = /home/administrator/.Sikulix/SikulixStore/SikulixOptions.txt
Options: *** options dump end
***** show environment for 2.0.4-2020-03-14_08:01 API
user.home: /home/administrator
user.dir (work dir): /home/administrator
user.name: administrator
java.io.tmpdir: /tmp
running 64Bit(amd64) on l (5.3.0-59-generic) from a jar
java 11 version 11 vm 11.0.7+10-post-Ubuntu-2ubuntu218.04 class 55.0 arch 64
app data folder: /home/administrator/.Sikulix
executing jar: /home/administrator/SikuliX/sikulixide-2.0.4.jar
*** classpath dump sikulix
  0: SikuliX/sikulixide-2.0.4.jar
*** classpath dump end
***** show environment end
[DEBUG]startUp: IDE: *********************** leaving start
[25 debug] Sikulix: starting IDE
[42 debug] RunTime:temp folder ok: /tmp/Sikulix_2020422462
Options: *** options dump
Options: testing =
Options: OptionsFile = /home/administrator/.Sikulix/SikulixStore/SikulixOptions.txt
Options: *** options dump end
***** show environment for 2.0.4-2020-03-14_08:01 IDE
user.home: /home/administrator
user.dir (work dir): /home/administrator
user.name: administrator
java.io.tmpdir: /tmp
running 64Bit(amd64) on l (5.3.0-59-generic) from a jar
java 11 version 11 vm 11.0.7+10-post-Ubuntu-2ubuntu218.04 class 55.0 arch 64
app data folder: /home/administrator/.Sikulix
executing jar: /home/administrator/SikuliX/sikulixide-2.0.4.jar
*** classpath dump sikulix
  0: /home/administrator/SikuliX/sikulixide-2.0.4.jar
  1: /home/administrator/.Sikulix/Extensions/jython-standalone-2.7.1.jar
  2: SikuliX/sikulixide-2.0.4.jar
*** classpath dump end
***** show environment end
[181 debug] IDE: running with Locale: en_US
[DEBUG]startUp: IDE: --- Sikuli parameters ---
[DEBUG]startUp: IDE: 1: -c
[DEBUG]startUp: IDE: 2: -v
[192 debug] RunTime:loadlib: trying JXGrabKey
[194 debug] RunTime:libsExport: folder exists: /home/administrator/.Sikulix/SikulixLibs (2.0.4 - 202003140801)
[195 debug] RunTime:loadLib: libJXGrabKey.so (success)
[195 debug] HotkeyManager: add Capture Hotkey: CTRL+SHIFT 2 (50, 3)
[198 debug] HotkeyManager: add Abort Hotkey: ALT+SHIFT C (67, 9)
[198 debug] IDE: Init ScriptingSupport
[201 debug] IDESupport: enter
[882 debug] Runner: added: JavaScript [js] text/javascript
[882 debug] Runner: added: SikulixJar [jar] text/jar
[883 debug] Runner: added: NetworkRunner [] NET
[893 debug] Runner: added: Jython [py] text/jython
[893 debug] Runner: added: PackedSikulix [zip] application/zip
[894 debug] Runner: added: PackedSikulix [skl] text/skl
[894 debug] Runner: added: Sikulix [] directory/sikulix
[895 debug] Runner: added: Text [txt] text/text
[896 debug] Runner: init: class org.sikuli.script.runners.AbstractLocalFileScriptRunner: warning: not possible
[896 debug] IDESupport: added: Jython
[896 debug] IDESupport: added: JavaScript
[896 debug] IDESupport: added: Text
[896 debug] IDESupport: exit: defaultrunner: Jython (py)
[899 debug] IDE: Reading Preferences
[900 debug] IDE: Adding components to window
[913 debug] IDE: [I18N] menuRecent
[930 debug] IDE: [I18N] menuToolAndroid
[933 debug] IDE: creating tabbed editor
[1019 debug] IDE: creating message area
[1077 debug] IDE: creating combined work window
[1079 debug] IDE: Putting all together
[1080 debug] IDE: Putting all together - after main pane
[1099 debug] IDE: Putting all together - after toolbar
[1100 debug] IDE: Putting all together - before layout
[1151 debug] IDE: Putting all together - after layout
[1151 debug] IDE: Putting all together - Restore last Session
[1152 debug] IDE: Restore scripts from last session
[1152 debug] IDE: Restore Sikuli script: /home/administrator/SikuliX/RPA/sikuliScript/coba2.sikuli
[1159 debug] EditorPane: created 1592800204433
[1165 debug] EditorPane: loadfile: /home/administrator/SikuliX/RPA/sikuliScript/coba2.sikuli
[1167 debug] JythonRunner: starting initialization
[1169 debug] RunTime:resourceLocation: (class org.sikuli.script.support.RunTime) /Lib/sikuli
[1170 debug] RunTime:resourceList: having jar: jar:file:/home/administrator/SikuliX/sikulixide-2.0.4.jar!/Lib/sikuli
[1186 debug] EditorPane: InitTab: (text/jython)
[1187 debug] SikuliEditorKit.read
[1192 debug] ImagePath: new BundlePath: /home/administrator/SikuliX/RPA/sikuliScript/coba2.sikuli
[1193 debug] EditorPane: setFiles: for: /home/administrator/SikuliX/RPA/sikuliScript/coba2.sikuli
[1207 debug] IDE: Restore Sikuli script: /home/administrator/test.sikuli
[1210 debug] EditorPane: created 1592800204484
[1212 debug] EditorPane: loadfile: /home/administrator/test.sikuli
[1215 debug] EditorPane: InitTab: (text/jython)
[1215 debug] SikuliEditorKit.read
[1219 debug] ImagePath: new BundlePath: /home/administrator/test.sikuli
[1220 debug] EditorPane: setFiles: for: /home/administrator/test.sikuli
[1223 debug] ImagePath: new BundlePath: /home/administrator/SikuliX/RPA/sikuliScript/coba2.sikuli
[1227 debug] Screen: initScreens: starting
[1227 debug] Screen: Accessing: GraphicsEnvironment.getLocalGraphicsEnvironment()
[1227 debug] Screen: Accessing: GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()
[1227 debug] Screen: ScreenDevice 0 has (0,0) --- will be primary Screen(0)
[1227 debug] Screen: Monitor 0: (0, 0) 1920 x 1080
[1228 debug] Mouse: init start
[1237 debug] Mouse: init end
[1238 debug] Screen: initScreens: ending
[1238 debug] IDE startup: 1.2 seconds *** Running on Java 9+
[debug] RunTime:files exported: 7 from: Lib/sikuli to:
 /home/administrator/.Sikulix/Lib/sikuli
[debug] Jython: added as Jython::sys.path[0]:
/home/administrator/.Sikulix/Lib/site-packages
[debug] Jython: ***** sys.path
 0: /home/administrator/SikuliX/RPA/sikuliScript/coba2.sikuli
 1: /home/administrator/.Sikulix/Lib/site-packages
 2: /home/administrator/.Sikulix/Lib
 3: /home/administrator/.Sikulix/Extensions/Lib
 4: /home/administrator/.Sikulix/Extensions/jython-standalone-2.7.1.jar/Lib
[3647 debug] JythonRunner: ready: version 2.7.1
[debug] ImagePath: new BundlePath: /home/administrator/test.sikuli
[debug] ImagePath: new BundlePath: /home/administrator/SikuliX/RPA/sikuliScript/coba2.sikuli

Rakha Fauzan (rakhafzn) said : #6

I have another problem, i just realized in the script there is a hover function. This function should make the mouse pointer go to the pointed location with the cross right? But when I run this script, the mouse pointer did not move at all.

Is something wrong with my configuration? Or does sikuli have some minimum requirement that my laptop fail to provide?

This is my spec:
Ubuntu 18.04.4 LTS 64-bit
Memory 7.5GiB
Processor Intel® Core™ i5-8265U CPU @ 1.60GHz × 8
Graphic Intel® UHD Graphics (Whiskey Lake 3x8 GT2)
Gnome 3.28.2
OS type 64-bit
Disk 125,5 GB

Java version:
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)

I have installed OpenCV (libopencv3.2) and Tesseract (tesseract 4.0.0-beta1)

RaiMan (raimund-hocke) said : #7

Your environment principally is ok.

The access to screen, mouse and keyboard seem to be blocked somehow.

Try another GUI manger instead of Gnome.

Generally I cannot help you with such special situations on Linux, since I do not have a possibility to test.

To get nearer to the cause, use simple and short test scripts, that concentrate on a key aspect.

Can you help with this problem?

Provide an answer of your own, or ask Rakha Fauzan for more information if necessary.

To post a message you must log in.