← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #663402]: Region.findText(): Finding text with Java API

 

Question #663402 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/663402

Jeff Hall posted a new comment:
Thanks for the confirmation RaiMan!

The problem must be on my end.  I keep getting a NullPointerException
from the screen.findText() method in the following example class, but
haven't been able to figure out why just yet...


public class DummyTest {

    private static Screen screen = new Screen();

    @BeforeClass
    public static void setup() {
        Settings.OcrTextSearch = true;
        Settings.OcrTextRead = true;
        screen.setAutoWaitTimeout(10);

        // Open Microsoft Word application
        screen.type(Key.ESC, Key.CTRL);
        screen.type("winword");
        screen.type(Key.ENTER);

    @AfterClass
    public static void tearDown() {
        // Close Microsoft Word
        screen.type(Key.F4, Key.ALT);
        screen.type("n");
    }

    @Test
    public void experimentWithText() {
        String text = "This is my favorite text string.";
        screen.type(text);

        try {
            screen.findText(text);
        } catch (FindFailed findFailed) {
            findFailed.printStackTrace();
        }

    }

}

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.