I am not able to find the Text on screen

Asked by Abilashkar on 2019-05-06

I am Using Java API to develop sikuli test when i try to find a
text on screen it throws an error .

Code:

private static Screen screen = new Screen();
public clickLogIn() throws FindFailed, InterruptedException {

        Settings.OcrTextSearch=true;
   Settings.OcrTextRead = true

   String text ="204";

         try {
             screen.findText(text);
         } catch (FindFailed findFailed) {
          System.out.println("Failed");
             findFailed.printStackTrace();
         }
}

Console Error:

[error] TextRecognizer not working: tessdata stuff not available at:
C:\Users\Abi\AppData\Roaming\Sikulix\SikulixTesseract\tessdata
Failed
FindFailed: 204 as text
  Line 2759, in file Region.java

 at org.sikuli.script.Region.wait(Region.java:2759)
 at org.sikuli.script.Region.findText(Region.java:2836)
 at org.sikuli.script.Region.findText(Region.java:2847)

PORM.XML

<repositories>
        <repository>
            <!-- OSSRH: com.sikulix -->
            <name>com.sikulix</name>
            <id>com.sikulix</id>
            <url>https://oss.sonatype.org/content/groups/public</url>
            <!--layout>default</layout-->
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
        <repository>
            <!-- OSSRH: com.sikulix -->
            <name>jxgrabkey</name>
            <id>jxgrabkey</id>
            <url>https://labs.consol.de/maven/repository/</url>
            <!--layout>default</layout-->
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>

 <!-- <dependencyManagement> <dependencies> <dependency> <groupId>org.sikuli</groupId>
  <artifactId>sikuli-script</artifactId> <version>X-1.0rc3</version> </dependency>
  </dependencies> </dependencyManagement> -->

 <dependencies>
  <!-- <dependency> <groupId>org.sikuli</groupId> <artifactId>sikuli-script</artifactId>
   </dependency> -->

  <dependency>
   <groupId>org.apache.xmlbeans</groupId>
   <artifactId>xmlbeans</artifactId>
   <version>${xmlbeans.version}</version>
  </dependency>

  <dependency>
   <groupId>org.apache.poi</groupId>
   <artifactId>poi-ooxml-schemas</artifactId>
   <version>${poi-ooxml-schemas.version}</version>
  </dependency>

  <dependency>
   <groupId>org.apache.poi</groupId>
   <artifactId>poi-ooxml</artifactId>
   <version>${poi-ooxml.version}</version>
  </dependency>

  <dependency>
   <groupId>org.apache.poi</groupId>
   <artifactId>poi</artifactId>
   <version>${poi.version}</version>
  </dependency>

 <dependency>
  <groupId>com.sikulix</groupId>
  <artifactId>sikulixapi</artifactId>
  <version>1.1.1</version>
 </dependency>

  <dependency>
   <groupId>com.sikulix</groupId>
   <artifactId>sikulixlibswin</artifactId>
   <version>1.1.0</version>
  </dependency>

  <dependency>
   <groupId>org.testng</groupId>
   <artifactId>testng</artifactId>
   <version>${testng.version}</version>
  </dependency>

  <dependency>
   <groupId>com.relevantcodes</groupId>
   <artifactId>extentreports</artifactId>
   <version>2.41.2</version>
  </dependency>
  <dependency>
   <groupId>org.apache.poi</groupId>
   <artifactId>poi</artifactId>
   <version>3.9</version>
  </dependency>

  <dependency>
    <groupId>org.jsoup</groupId>
    <artifactId>jsoup</artifactId>
    <version>1.8.3</version>
</dependency>
<dependency>
      <groupId>com.github.vidstige</groupId>
      <artifactId>jadb</artifactId>
      <version>-v1.0-g94ebf38-23</version>
    </dependency>

 </dependencies>

Please help to resolve this error. Thanks in advance.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2019-05-20
Last reply:
2019-05-20

This question was reopened

RaiMan (raimund-hocke) said : #1

you should use version 1.1.4-SNAPSHOT

http://sikulix.com

Abilashkar (abilashkar) said : #2

[error] Settings: load version file sikulixversion.txt did not work
FAILED:

java.lang.ExceptionInInitializerError
 at org.sikuli.script.Sikulix.cleanUp(Sikulix.java:459)
 at org.sikuli.script.Sikulix.endError(Sikulix.java:415)
 at org.sikuli.script.RunTime.initSikulixOptions(RunTime.java:1688)

I tried to add maven its not downloading so i downloaded respective jar from the repo add added to build path but its not resolving the dependencies
repo used to download:
https://oss.sonatype.org/content/groups/public/com/sikulix/sikulixapi/1.1.4-SNAPSHOT

RaiMan (raimund-hocke) said : #3

That is all you need for version 1.1.4

Remove anything else referencing SikuliX.

  <repositories>
    <repository>
      <id>sonatype-ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.sikulix</groupId>
      <artifactId>sikulixapi</artifactId>
      <version>1.1.4-SNAPSHOT</version>
    </dependency>
  </dependencies>

Abilashkar (abilashkar) said : #4

Thanks RaiMan, that solved my question.

Abilashkar (abilashkar) said : #6

Hi Rail Man,
on my another application the text is not identifying . The screen is full of chart and values . is there any solution to handle that screen. if i give the image of particular area i am able to click but i cannot say that value image will present nxt time because the values are appearing dynamic . So please let me know is there any solution

Thanks in advance

Abilashkar (abilashkar) said : #7

Hi Rail Man,
on my another application the text is not identifying . The screen is full of chart and values . is there any solution to handle that screen. if i give the image of particular area i am able to click but i cannot say that value image will present nxt time because the values are appearing dynamic . So please let me know is there any solution

Thanks in advance

RaiMan (raimund-hocke) said : #8

try with 1.1.4: transparency feature

Abilashkar (abilashkar) said : #9

transparency feature any reference or commands?

Abilashkar (abilashkar) said : #11

i have tried this this is also not identify the text which i give . but in that screen that text is visible.

Abilashkar (abilashkar) said : #12

is there any other way to find the text on screen only im struck with particular screen . Other screens im able to identify the text and able to click

RaiMan (raimund-hocke) said : #13

--- is there any other way to find the text on screen
not really, because they all rely on the same base features (Tess4J/Tesseract).

... the only other way would be to use a shot image of the text

You might send me screenshots of samples that work and of samples that do not work
(sikulix---at---outlook---dot---com)

Can you help with this problem?

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

To post a message you must log in.