Click the text on screen in Java

Asked by James Sawyer on 2018-12-25

I have a Maven project in IntelliJ that utilizes sikulix v. 1.1.3.

I can extract the text from a certain region:

  Settings.OcrTextSearch = true;
  Settings.OcrTextRead = true;
  Region r = Region.create(0,0,500,500);

But I cannot use findText or existsText in any way - calling these methods results in exceptions:

  r.findText("Test"); // FindFailed even though "Test" is a part of what text() returns

The result is the same for findWord() in sikulix v. 1.1.4:

  r.findWord("Test"); // Gives the NullPointerException

My task is to check whether some certain text exists on screen and, if so, click it. Whereas I can do the verification by checking whether the returned text (text()) contains some word, I have no idea how to find the location of this word on the screen. Can you please point me in the right direction here? A code snippet for Java would help a lot.

Thank you.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

Please try again with the latest sikulixapi snapshot from today (build #155)

In doubt delete the sikulixapi-1.1.4 branch in the local maven repo, to force Maven to re-download the latest snapshot.

Can you help with this problem?

Provide an answer of your own, or ask James Sawyer for more information if necessary.

To post a message you must log in.