VNCScreen.capture doesnt work

Asked by Ben weiss on 2020-10-26

I am performing a click action on a remote VNC session. I take a capture of before the click happens and after the click happens.

I can manually verify that the click happened. The post.png DOES NOT resemble after the click happened. its identical to the pre.png.

here is the code

VNCScreen vncSesh = VNCScreen.start("", 5900, "password", 10, 10);
Pattern pattern = new Pattern("test.png");
vncSesh.capture().save("/Pictures, "pre.png");;
vncSesh.capture().save("/Pictures", "post.png");

 this is with Sikuli 2.0+. I had this issue with an old Sikuli and thought if i got the Sikuli 2.0+ working it wouldnt have this problem but im still having the same issue. I am using sikuli through the api.jar for java. Why isnt the capture() taking a picture of after the click happens?

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:

This question was reopened

RaiMan (raimund-hocke) said : #1

Sorry for ignoring your other question, that meanwhile expired.

The VNC support is not my priority and the implementation is based on a contribution 3 years ago.

I will setup a test configuration again, to finally decide how to deal with the VNC support in the future.

A detailed description of you setup would surely help.

Ben weiss (benjimyma) said : #2

no worries. thanks for the response.

im on a centos distro and run sikuli from a java program. TigerVNC is installed and works accordingly on my machine.

I cant give away more detailed descriptions because of the work environment im in but i will gladly answer questions and assist in this issue if you find anything that could possibly be a solution.

RaiMan (raimund-hocke) said : #3

Are you running the TigerVNC server on the same machine as the SikuliX program?

Ben weiss (benjimyma) said : #4

no, its over an internal network. i verified that the VNC connection is healthy and can be used in a normal config (i can use vncviewer over default port 5900 and specific ip). The picture that SikuliX takes from java is of the first second that the VNC screen is connected.

RaiMan (raimund-hocke) said : #5

ok. thanks.

Jeff_Vallis (vallis-pj) said : #6

May or May not help
My Screen Shot Function - please don't Laugh

def Screen_Shot_Set_and_Copy_Procedure(v_Dir,Screen_Shot_File,Need_a_Copy,x,y,w,h):
    screenshotsDir = Get_Location(v_Dir)
    import shutil
    import os
    print "Screen_Shot_Set_and_Copy",x,y,w,h
    some_region = SCREEN # for whole screen
    someRegion = App.focusedWindow() # for the frontmost windo
    img = capture(some_region)
    my_file = Screen_Shot_File
    print "Sub_Take_Screen_Shot_and_Copy() "+screenshotsDir + my_file + ".png"
    localtime = time.localtime(time.time())
    timestring = time.strftime ('%m%d%H%M%S')
    my_file = my_file + ".png"
    shutil.move(img, os.path.join(screenshotsDir, my_file))
    if Need_a_Copy == 1:
        my_copy = my_file + " copy " + timestring + ".png"
        shutil.copy(os.path.join(screenshotsDir, my_file), os.path.join(screenshotsDir, my_copy))
        print "Sub_Take_Screen_Shot_and_Copy() ",screenshotsDir, my_copy

Ben weiss (benjimyma) said : #7

Thanks for the input Jeff; however, im trying to screenshot the VNC session which is a screen coming from over the network (im also running java).

Can you help with this problem?

Provide an answer of your own, or ask Ben weiss for more information if necessary.

To post a message you must log in.