gajendravaradhan / sikuli-api

Automatically exported from code.google.com/p/sikuli-api
0 stars 0 forks source link

Mouse assumes ScreenLocation.getScreen will be a DesktopScreen, but that's not true here #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Here's a snippet of code where the resulting Screen is an anonymous inner class 
from ScreenRegion.snapshot:

(This is written in Xtend)

        var s = new ScreenRegion
        var m = new Mouse
        m.click(s.find(new TextTarget('HelloWorldExample.java')).center)

Results in:

Exception in thread "main" java.lang.ClassCastException: 
org.sikuli.api.ScreenRegion$1 cannot be cast to 
org.sikuli.api.robot.DesktopScreen
    at org.sikuli.api.robot.Desktop.getMouse(Desktop.java:111)
    at org.sikuli.api.robot.Mouse.getDesktopMouse(Mouse.java:14)
    at org.sikuli.api.robot.Mouse.click(Mouse.java:38)
    at com.dingrocket.e2e.WebTests.run(WebTests.java:22)
    at com.dingrocket.e2e.WebTests.main(WebTests.java:39)

My workaround is to create a new ScreenLocation with the existing one's x and y 
but the proper DesktopScreen instance

Original issue reported on code.google.com by jasonpar...@gmail.com on 25 Oct 2012 at 5:54

GoogleCodeExporter commented 8 years ago
Thank you for reporting this bug!

Original comment by doubles...@gmail.com on 28 Oct 2012 at 1:28