← Back to team overview

sikuli-driver team mailing list archive

[Question #268580]: questions about sikulifirefoxdriver

 

New question #268580 on Sikuli:
https://answers.launchpad.net/sikuli/+question/268580

I just discovered sikuli and I am having some trouble getting the SikuliFirefoxDriver to work the way I would like. I am trying to use Sikuli (and selenium) to click on buttons in a flash program running in my browser. If I try to do it manually by grabbing a screenshot of the desktop, it works:

ScreenRegion s = new DesktopScreenRegion();
Target target = new ImageTarget(new File("2button.png"));
ScreenRegion r = s.find(target);
Mouse mouse = new DesktopMouse();
mouse.click(r.getCenter());

but if I try to use the SikuliFirefoxDriver

ImageElement image = driver.findImageElement(new File("2button.png").toURI().toURL());
image.click();

I get a casting error when it finds the image:

Exception in thread "Thread-4" java.lang.ClassCastException: java.lang.String cannot be cast to org.openqa.selenium.WebElement
        at org.sikuli.webdriver.SikuliFirefoxDriver.findElementByLocation(SikuliFirefoxDriver.java:35)
        at org.sikuli.webdriver.SikuliFirefoxDriver.findImageElement(SikuliFirefoxDriver.java:53)

I don't understand why a String or a WebElement would show up there.

Also, how do I turn on OCR feature in SikuliFirefoxDriver, so I can try and recognize sections of text and click on them? Is there a simple way to grab the screenshot from selenium browser and turn it into a sikuli screen that can be clicked on? I want to have multiple instances running at the same time and I assume when you grab the desktop, it only grabs the images that are visible in front.


-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.