Text Search off error on image [Sikuli java Eclipse]

Asked by Tepedino

First of all, hello.

I'm trying to use Sikuli in my workplace to automate tests over Flex, and by recommendation of other workers and superios, I should use Sikuli together with Eclipse so everyone could use the same IDE, and that I could use it java-like.

Tried to follow some tutorials to start somehtign simple, here are the links for the tutorials:
http://www.softwaretestinghelp.com/sikuli-tutorial-part-1/
http://doc.sikuli.org/faq/030-java-dev.html

BUT I'm stuck with this error:

-----
[error] txt_image.png looks like a file, but not on disk. Assume it's text.
FindFailed: Text search currently switched off
  Line 1671, in file Region.java

 at org.sikuli.script.Region.wait(Region.java:1671)
 at org.sikuli.script.Region.find(Region.java:1590)
 at org.sikuli.script.Region.getLocationFromTarget(Region.java:1991)
 at org.sikuli.script.Region.click(Region.java:2197)
 at org.sikuli.script.Region.click(Region.java:2181)
 at teste.teste.main(teste.java:11)
[error] Region.find(text): text search is currently switched off
[error] doc_image.png looks like a file, but not on disk. Assume it's text.
[error] Region.find(text): text search is currently switched off
-----

The code I have is a simple "open notepad from desktop and write", follows the code (I tell already that is the same code as it shows on the first link I sent here, but changed to have my imgs):

-----
package test;

import org.sikuli.script.*;

public class teste {

 public static void main(String[] args) {

  Screen s=new Screen();
  try{
   s.click("txt_image.png");
   s.find("doc_image.png");
  }
  catch(FindFailed e){
   e.printStackTrace();
  }
  s.type("doc_image.png","This is Nice Sikuli Tutorial!!!!");

 }

}
-----

Tried to look on google, stacksoverflow, and even similar questions here but am sill stuck on this.

OS si Windows 7, 64 bits. JRE is 1.6.0_22.

Thanks for your time,

Augusto.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Tepedino
Solved:
Last query:
Last reply:
Revision history for this message
Tepedino (augusto-tepedino) said :
#1

Oh yes, sorry!

Forgot somethign that might be related to the roblem:

I both links it was asked for em to add "sikuli-script.jar" tot he jexternal libs, and at the setup was told that option 4 would generate it, yet it generated "sikuli-java.jar". Assumed it was only a name change and tried to continue.

Thanks,

Augusto.

Revision history for this message
Eugene S (shragovich) said :
#2

It looks like Sikuli can't find these files on your disk. Are you sure it looks for the in the right location?

Revision history for this message
Tepedino (augusto-tepedino) said :
#3

Well, I added a new folder and then added the .pngs there, dunno if I should do it another way.

This is the first time I'm using imgs on selenium

Revision history for this message
Eugene S (shragovich) said :
#4

Selenium or Sikuli? :)

Anyway, just to be certain, try to use full path and see if that works for you. For example something like that:

Screen s = new Screen();
s.find("C:\\...\\image.png").highlight(1);

Revision history for this message
Tepedino (augusto-tepedino) said :
#5

Sorry, I meant Eclipse (sikuli on eclipse to be more specific). the part 2 of the first link I added here have an explanation on hwo to add everything to work with selenium, tat's why I got confuse.

Hn... Will try that tomorrow at work. I'm not using on personal computer since I'm using Sikuli IDE to do automated tests on Flex and I don't want to mess with the graduation tests.

Revision history for this message
Tepedino (augusto-tepedino) said :
#6

@Eugene

So, tried now at work adding the full path to see if it would work, the error I got is the same, only changed the name of the archive that looks like a file:

-----
[error] C:\Users\augusto.martins\Desktop\txt_image.png looks like a file, but not on disk. Assume it's text.
FindFailed: Text search currently switched off
  Line 1671, in file Region.java

 at org.sikuli.script.Region.wait(Region.java:1671)
 at org.sikuli.script.Region.find(Region.java:1590)
 at org.sikuli.script.Region.getLocationFromTarget(Region.java:1991)
 at org.sikuli.script.Region.click(Region.java:2197)
 at org.sikuli.script.Region.click(Region.java:2181)
 at teste.teste.main(teste.java:11)
[error] Region.find(text): text search is currently switched off
[error] C:\Users\augusto.martins\Desktop\doc_image.png looks like a file, but not on disk. Assume it's text.
[error] Region.find(text): text search is currently switched off
-----

Revision history for this message
Eugene S (shragovich) said :
#7

hmm, that's strange.
I can't even force myself to get this error. In my case, even if I deliberately use image with incorrect path I get the following error:

[error] Image: Image not valid, but TextSearch is switched off!

and not the one you are getting.

I tried to look at the Sikuli code and it looks like that error is comes from Finder.setTargetSmartly() method which is not even called in my case.

Maybe some versions differences? What version are you using?

Revision history for this message
Tepedino (augusto-tepedino) said :
#8

I'm using Sikuli 1.0.1.

yet I'm curious on why I cant get sikuli-script.jar, only sikuli-java.jar, would be a problem?

the -java.jar appears wiht option 4 when I run the setup

Revision history for this message
RaiMan (raimund-hocke) said :
#9

sikuli-script.jar contains the Jython 2.5, whereas sikuli-java.jar contains only the Jython and Java API (hence you need an external Jython to run scripts).

Revision history for this message
Eugene S (shragovich) said :
#10

To test that I was using Sikuli API that I got using Maven and its version is 1.1.0
Maybe try this version?

Revision history for this message
Tepedino (augusto-tepedino) said :
#11

 @Eugene:
Will try the 1.1.0 here now.

@RaiMan:
I see, so with this external Jython will I be able to run it with jaba over eclipse? D=

Gimme few more mintues and will post here the results.

Revision history for this message
Tepedino (augusto-tepedino) said :
#12

@Eugene:
Tried to add 1.1.0 and I got this message:
Somethign serious happened! Sikuli not useable!
Check the error log at "...\SikuliX-1.1.0-SetupLog.txt"

The log:

[debug (20/07/15 14:39:31)] Debug: setLogFile: C:\Sikuli 1.1.0\SikuliX-1.1.0-SetupLog.txt
[debug (20/07/15 14:39:31)] RunSetup: ... starting with no args given
[debug (20/07/15 14:39:31)] RunSetup: Setup: 1.1.0 2015-07-20_01:00nightly in folder:
C:\Sikuli 1.1.0
[debug (20/07/15 14:39:31)] RunSetup: RunningSystem: Windows 6.1
[debug (20/07/15 14:39:31)] RunSetup: parent of jar/classes: C:\Sikuli 1.1.0
[debug (20/07/15 14:39:31)] RunSetup: RunningJava: Java 6 (amd64) 1.6.0_22-b04
[debug (20/07/15 14:39:31)] init user preferences
[debug (20/07/15 14:40:48)] RunSetup:
popAsk: --------------------
The following file(s) will be downloaded to
C:\Sikuli 1.1.0
--- Native support libraries for Windows (sikulixlibs...)
--- Package 1 ---
sikulixsetupIDE-1.1.0-20150719.231243-133-forsetup.jar (IDE/Scripting)
sikulixsetupAPI-1.1.0-20150719.231156-133-forsetup.jar (Java API)
 - with Jython
--- Package 2 ---
sikulixsetupAPI-1.1.0-20150719.231156-133-forsetup.jar (done in package 1)
Only click NO, if you want to terminate setup now!
Click YES even if you want to use local copies in Downloads!
--------------------
[debug (20/07/15 14:40:53)] RunSetup:
popAsk: --------------------
You have for Windows native libs
C:\Users\augusto.martins\AppData\Roaming\Sikulix\SikulixDownloads_201507200100\sikulixlibswin-1.1.0-20150719.230303-209.jar
Click YES, if you want to use this for setup processing
... or click NO, to ignore it and download a fresh copy
--------------------
[debug (20/07/15 14:41:08)] RunSetup: Copied from Downloads: sikulixlibswin
[debug (20/07/15 14:41:08)] FileManager: resetFolder:
C:\Users\augusto.martins\AppData\Roaming\Sikulix\sikulixlibs\windows
jar:file:/C:/Sikuli 1.1.0/sikulixlibswin.jar
[error (20/07/15 14:41:08)] RunTimeSETUP: doResourceListJar: java.io.EOFException: Unexpected end of ZLIB input stream
[debug (20/07/15 14:41:08)] FileManager: download to string from:
https://oss.sonatype.org/content/groups/public/com/sikulix/sikulixsetupAPI/1.1.0-SNAPSHOT/maven-metadata.xml,
[debug (20/07/15 14:41:09)] RunSetup: getMavenJar: sikulixsetupAPI-1.1.0-20150719.231156-133-forsetup.jar
[debug (20/07/15 14:41:09)] FileManager: Downloading sikulixsetupAPI-1.1.0-20150719.231156-133-forsetup.jar having 2036 KB
[debug (20/07/15 14:42:49)] FileManager: downloaded 2036 KB to:
C:\Users\augusto.martins\AppData\Roaming\Sikulix\SikulixDownloads_201507200100\sikulixsetupAPI-1.1.0-20150719.231156-133-forsetup.jar
[debug (20/07/15 14:42:49)] FileManager: download time: 99
[debug (20/07/15 14:42:52)] RunSetup: Copied from Downloads: sikulixapi
[debug (20/07/15 14:42:52)] FileManager: resetFolder:
C:\Users\augusto.martins\AppData\Roaming\Sikulix\Lib
jar:file:/C:/Sikuli 1.1.0/sikulixapi.jar
[debug (20/07/15 14:42:52)] FileManager: download to string from:
https://oss.sonatype.org/content/groups/public/com/sikulix/sikulixsetupIDE/1.1.0-SNAPSHOT/maven-metadata.xml,
[debug (20/07/15 14:42:52)] RunSetup: getMavenJar: sikulixsetupIDE-1.1.0-20150719.231243-133-forsetup.jar
[debug (20/07/15 14:42:53)] FileManager: Downloading sikulixsetupIDE-1.1.0-20150719.231243-133-forsetup.jar having 4062 KB
[debug (20/07/15 14:49:08)] FileManager: downloaded 4062 KB to:
C:\Users\augusto.martins\AppData\Roaming\Sikulix\SikulixDownloads_201507200100\sikulixsetupIDE-1.1.0-20150719.231243-133-forsetup.jar
[debug (20/07/15 14:49:08)] FileManager: download time: 374
[debug (20/07/15 14:49:11)] RunSetup: Copied from Downloads: sikulix
[debug (20/07/15 14:49:11)] RunSetup: running on Java 6: need to use Jython 2.5 - which is downloaded
[debug (20/07/15 14:49:12)] FileManager: Downloading jython-standalone-2.5.4-rc1.jar having 10052 KB
[debug (20/07/15 14:56:25)] FileManager: downloaded 10052 KB to:
C:\Users\augusto.martins\AppData\Roaming\Sikulix\SikulixDownloads\jython-standalone-2.5.4-rc1.jar
[debug (20/07/15 14:56:25)] FileManager: download time: 432
[debug (20/07/15 14:56:28)] RunSetup: Copied from Downloads: Jython
[debug (20/07/15 14:56:28)] RunSetup: Download ended
[debug (20/07/15 14:56:28)] RunSetup: Downloads for selected options:
sikulixsetupIDE-1.1.0-20150719.231243-133-forsetup.jar sikulixsetupAPI-1.1.0-20150719.231156-133-forsetup.jar jython-standalone-2.7.0.jar
[debug (20/07/15 14:56:28)] RunSetup: adding needed stuff to sikulixapi.jar
[debug (20/07/15 14:56:28)] FileManager: buildJar: sikulixtemp.jar
[debug (20/07/15 14:56:28)] FileManager: buildJar: adding: sikulixapi.jar
[debug (20/07/15 14:56:29)] FileManager: buildJar: adding: sikulixlibswin.jar
[error (20/07/15 14:56:29)] FileManager: buildJar: java.io.EOFException: Unexpected end of ZLIB input stream
[debug (20/07/15 14:56:29)] RunSetup: renaming sikulixtemp.jar to target jar: sikulixapi.jar
[debug (20/07/15 14:56:29)] RunSetup: rename did not work --- trying copy
[debug (20/07/15 14:56:29)] FileManager: deleteFileOrFolder:
C:\Sikuli 1.1.0\sikulixtemp.jar
[error (20/07/15 14:56:29)] RunSetup: did not work
[error (20/07/15 14:56:29)] RunSetup:
[error (20/07/15 14:56:29)] RunSetup: ... terminated abnormally :-(
[debug (20/07/15 14:56:29)] RunSetup:
popError: --------------------
Something serious happened! Sikuli not useable!
Check the error log at C:\Sikuli 1.1.0\SikuliX-1.1.0-SetupLog.txt
--------------------
[debug (20/07/15 14:58:17)] RunTimeSETUP: final cleanup
[debug (20/07/15 14:58:17)] FileManager: deleteFileOrFolder:
C:\Users\AUGUST~1.MAR\AppData\Local\Temp\Sikulix_1568105128

Revision history for this message
RaiMan (raimund-hocke) said :
#13

please use the latest build.

Revision history for this message
Tepedino (augusto-tepedino) said :
#14

Well, I tried .-.

The log I added here last was just the log of the latest version I tried to use in my work's machine...

I'm not being able to pass it and try what @Eugene told me to try with maven.

Revision history for this message
Tepedino (augusto-tepedino) said :
#15

ok, I tried today after lookign a little more at the link:
http://doc.sikuli.org/faq/030-java-dev.html

then I noticed the most ridiculous, stupid thign that was lacking:

the PATH TO THE IMAGES WAS WRONG

I was adding them into the "imgs" folder inside the workspace but was tryignt o look for them outside it.

so I did this:

package teste;

import java.io.IOException;

import org.sikuli.script.*;

public class teste {

 public static void main(String[] args) {

/* Runtime rt = Runtime.getRuntime();

  try {
   rt.exec(new String[] {"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "http://10.10.1.17:8090/VisActAccessServer/main.atn"});
  } catch (IOException e1) {
   // TODO Auto-generated catch block
   e1.printStackTrace();
  } */

  Screen s=new Screen();
  try{
   s.doubleClick("imgs/txt_image.png");

  }
  catch(FindFailed e){
   e.printStackTrace();
  }
  s.type("This is Nice Sikuli Tutorial!!!!");

 }

}

and it worked!

Thanks for the help, I wouldn't notice the little thigns without it.

(note: tried on 1.0.1)