VNC - problem finding an image

Asked by maria beatrice martini on 2018-12-04

I've problem finding an image/clicking on it.

After the connection I capture the VNC screen and the image contain the image.

The problem is in first click: scr.click("1541417310503.png")

Below my script

------------------------------------------------------------------------------------------------------

import shutil

##############################################
screenType = 0 # 1 = screen(0), 2 = vnc screen
##############################################
scr = object()

def vncConnection(scr):
   try:
        scr=vncStart("127.0.0.1", 5900, 10, 1000, "vnc");
   except:
        print("exception: " , sys.exc_info()[0])
        print(" " , sys.exc_info()[1])
        print(" " , sys.exc_info()[2])
        return None
   if not scr:
       print "no connection"
       return None
   wait(3)
   return scr

items =("Nothing selected","VNC Screen","Your PC screen")
selected = select("Please select from list the type of screen", options = items)

if selected == None: # Esc button
    exit(-1)
if selected == items[0]:
    popup("No selection")
    exit(-2)
if selected == items[1]:
    screenType = 1;
if selected == items[2]:
    screenType = 2;
if screenType == 1:
    scr = vncConnection(scr)
    if scr == None:
        exit(-1)
if screenType == 2:
    scr = Screen(0)

###################################################

Settings.UserLogs = True #(False: user log calls are ignored)
Settings.UserLogPrefix = "user" #(message prefix)
Settings.UserLogTime = True
b=getBundleFolder()
Debug.setUserLogFile(b + "DebugSikuliX.log")
imagePath = b+'savedImages\\'

sPath=capture(scr)
print("sPath=" +sPath)
newImage = os.path.join(imagePath, "test" + ".png")
print("imagePath=" + imagePath + " newImage=" + newImage)

shutil.move(sPath, newImage)

scr.click("1541417310503.png")

while not scr.exists("2018-11-05_12h30_58.png"):
    src.sleep(1)
scr.click("2018-11-05_12h30_58.png")
scr.type ("notepad")
while not scr.exists("2018-11-05_12h41_45.png"):
    src.sleep(1)
scr.click("2018-11-05_12h41_45.png")
while not scr.exists("2018-11-05_12h56_53.png"):
    src.sleep(1)
scr.type('n', Key.CTRL)
while not scr.exists("1541427508737.png"):
    src.sleep(1)
scr.type(Key.ENTER)
scr.type ('Hello , nice to be here' + Key.ENTER)
a = scr.find("1543410943455.png").text()
print a

if screenType == 1:
    scr.stop()
    use()

###################################################

exit(0)

----------------------------------------------------------------------------------------------------------------
exception

CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8

sPath=C:\Users\mib1sbz\AppData\Local\Temp\Sikulix_81169589\sikuliximage-1543909964798.png
imagePath=C:\sviluppo\REACT\SikuliX\Test_BMartini\vnc.sikuli\savedImages\ newImage=C:\sviluppo\REACT\SikuliX\Test_BMartini\vnc.sikuli\savedImages\test.png

[error] script [ vnc ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\sviluppo\REACT\SikuliX\Test_BMartini\vnc.sikuli\vnc.py", line 57, in <module> scr.click("1541417310503.png") Line 2277, in file Region.java
at org.sikuli.script.Region.wait(Region.java:2277)
at org.sikuli.script.Region.wait(Region.java:2295)
at org.sikuli.script.Region.getLocationFromTarget(Region.java:3270)
at org.sikuli.vnc.VNCScreen.getLocationFromTarget(VNCScreen.java:171)
at org.sikuli.script.Region.click(Region.java:3875)
at org.sikuli.script.Region.click(Region.java:3860)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
org.sikuli.script.FindFailed: FindFailed: 1541417310503.png: (39x37) in R[0,0 1680x1050]@S(0) E:Y, T:3.0 Line 2277, in file Region.j

ava

--------------------------------------------------------------------------------------------------------------------------------------------

- Window 7 64 bit SP1
- UltraVnc: VNC server version 1.2.1.1
- Siculix 1.1.4-SNAPSHOT-2018-10-26_10/Windows6.1/Java8(64)1.8.0_191-b12

----------------------------------------------------------------------------------------------------------------------------------------------

Thank you in advance.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-12-04
Last reply:
2018-12-04
RaiMan (raimund-hocke) said : #1

Did you already check, wether the offending image can be found in the shot you stored before?

maria beatrice martini (mbmar) said : #2

Yes, "1541417310503.png" is present in the shot. The script works fine if you select "Your pc screen", it doesn't work with "VCN Screen".

Please let me know, if you need the shot and the image. I can't attach them here.

RaiMan (raimund-hocke) said : #3

The vnc-shot, local-shot and the image would help.
mail: sikulix---at---outlook---dot---com

Can you help with this problem?

Provide an answer of your own, or ask maria beatrice martini for more information if necessary.

To post a message you must log in.