SikuliLibrary: Problem with Click on Region

Asked by MAR on 2020-09-08

Hello,

- I have a problem for using "Click On Region" keyword, I use it like this:
    Click On Region [${x},${y},${w3},${h2}] TMS.png
I obtain error:
00:00:00.001 KEYWORD SikuliLibrary . Click On Region [${x},${y},${w3},${h2}], TMS.png
Documentation:
Click On Region there's no offset to be configured works with the keyword Get Extended Region From
Start / End / Elapsed: 20200908 17:03:07.557 / 20200908 17:03:07.558 / 00:00:00.001
17:03:07.558 FAIL Keyword 'SikuliLibrary.Click On Region' expected 1 argument, got 2.

Before I calculate coordinates need like this:
    @{screencoordinates}= Get Screen Coordinates
    ${x} Set variable @{screencoordinates}[0]
    ${y} Set variable @{screencoordinates}[1]
    ${w} Set variable @{screencoordinates}[2]
    ${h} Set variable @{screencoordinates}[3]
    ${w3}= Evaluate ${w}/3
    ${h2}= Evaluate ${h}/2
    ${w32}= Evaluate ${w3}*2

I obtain the same problem if I enter the coordinates directly: Click On Region [0, 0, 1280, 1080] TMS.png

=> I use keywords from this guide: http://rainmanwy.github.io/robotframework-SikuliLibrary/doc/SikuliLibrary.html
It seems me correctly write, why I obtain: "Keyword 'SikuliLibrary.Click On Region' expected 1 argument, got 2." ?

- Also I got a problem with "Highlight Region" keyword, I use it like this:
    Highlight Region [0, 0, 1280, 1080] 3

I obtain error:

00:00:00.004 KEYWORD SikuliLibrary . Highlight Region [0, 0, 1280, 1080], 3
Documentation:

Highlight region
Start / End / Elapsed: 20200908 17:20:25.645 / 20200908 17:20:25.649 / 00:00:00.004
17:20:25.649 INFO Params: [[0, 0, 1280, 1080], 3]
17:20:25.649 FAIL java.lang.NullPointerException: null
17:20:25.649 DEBUG java.lang.NullPointerException
 at com.github.rainmanwy.robotframework.sikulilib.keywords.ScreenKeywords.highlightRegion(ScreenKeywords.java:552)
 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)
 at org.robotframework.javalib.reflection.KeywordInvoker.invoke(KeywordInvoker.java:50)
 at org.robotframework.javalib.beans.annotation.AnnotationKeywordExtractor$1.execute(AnnotationKeywordExtractor.java:62)
 at org.robotframework.javalib.library.KeywordFactoryBasedLibrary.runKeyword(KeywordFactoryBasedLibrary.java:37)
 at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:81)
 at com.github.rainmanwy.robotframework.sikulilib.SikuliLibrary.runKeyword(SikuliLibrary.java:40)
 at com.github.rainmanwy.robotframework.sikulilib.SikuliLibrary.runKeyword(SikuliLibrary.java:46)
 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)
 at org.robotframework.remoteserver.library.DynamicApiRemoteLibrary.runKeyword(DynamicApiRemoteLibrary.java:65)
 at org.robotframework.remoteserver.servlet.ServerMethods.run_keyword(ServerMethods.java:90)
 at org.robotframework.remoteserver.servlet.ServerMethods.run_keyword(ServerMethods.java:154)
 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)
 at org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.invoke(ReflectiveXmlRpcHandler.java:115)
 at org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.execute(ReflectiveXmlRpcHandler.java:106)
 at org.apache.xmlrpc.server.XmlRpcServerWorker.execute(XmlRpcServerWorker.java:46)
 at org.apache.xmlrpc.server.XmlRpcServer.execute(XmlRpcServer.java:86)
 at org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:200)
 at org.apache.xmlrpc.webserver.XmlRpcServletServer.execute(XmlRpcServletServer.java:112)
 at org.apache.xmlrpc.webserver.XmlRpcServlet.doPost(XmlRpcServlet.java:196)
 at org.robotframework.remoteserver.servlet.RemoteServerServlet.doPost(RemoteServerServlet.java:122)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
 at org.robotframework.remoteserver.servlet.RemoteServerServlet.service(RemoteServerServlet.java:102)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
 at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
 at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
 at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
 at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
 at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
 at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
 at org.eclipse.jetty.server.Server.handle(Server.java:348)
 at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
 at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
 at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
 at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)
 at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
 at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
 at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606)
 at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
 at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
 at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
 at java.lang.Thread.run(Unknown Source)

=> It seems that in the three cases the problem comes from coordinates, I enter it correctly?
I precise that "Highlight Region" keyword works correctly without entering coordinates

=> Is it necessary to start server manually? with command java -jar SikuliLibrary.jar <port> <captured_imagine_folder>

Thank you for your help!

Laurent

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-09-08
Last reply:
2020-09-09
RaiMan (raimund-hocke) said : #1

You use:
Click On Region [0, 0, 1280, 1080] TMS.png

which means you are using 2 parameters: coordinates, image

the error says:
Keyword 'SikuliLibrary.Click On Region' expected 1 argument, got 2

Hence you can only use 1 parameter, in your case the coordinates (no matter wether calculated or given).

Click On Region [0, 0, 1280, 1080]

should work.

please ask questions about SikuliLibrary in the issues of http://rainmanwy.github.io/robotframework-SikuliLibrary/ (not my responsibility)

MAR (olimar0613) said : #2

Thank you RaiMan for your answer.

In fact Click On Region [0, 0, 1280, 1080] doesn't work too.
Normally the image is needed, examples from SikuliLibrary :
Click on region [x,y,w,h] image.png
Click on region [x,y,w,h] image.png 0
Click on region [x,y,w,h] image.png 0 2
http://rainmanwy.github.io/robotframework-SikuliLibrary/doc/SikuliLibrary.html

I ask the question to rainmanwy.

Best regards