How to find a text on flash webpage using java

Asked by vignesh

I am using sikuli with java. I want to find a text on flash webpage and click it.

I tried using "screen.findText("Text to find on screen");" in Eclipse(Java). But i ended with following error:

Exception in thread "main" FindFailed: Region.findText: not yet implemented
  Line 1729, in file Region.java

 at org.sikuli.script.Region.findText(Region.java:1729)
 at org.sikuli.script.Region.findAllText(Region.java:1757)
 at demoscript.Dashboard_operations.Template_creation(Dashboard_operations.java:679)
 at demoscript.Dashboard_operations.main(Dashboard_operations.java:139)

Please suggest me the proper usage to find a text on screen and click on it using java.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

not a bug

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

according to the docs, it is still with version 1:
find("some text")

Revision history for this message
vignesh (vigneshtr) said :
#3

Thanks RainMan for your instant reply.

I am unable to find the text as you suggested using find("some text").

I got the following error:

Exception in thread "main" FindFailed: Text search currently switched off

Also i need to click the found text(Text which will be in Drop down list)...This is my complete question i raised.

Thanks i n Advance..

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

Be sure to have SikuliX setup with Option 3 (Text feature).

In your script say:
Settings.OcrTextSearch = True

to switch it on.

Revision history for this message
vignesh (vigneshtr) said :
#5

Raiman, FYI,

1. I used Sikuli-setup.jar for sikuli configuration version:1.0.1

2. I am not using Sikuli-IDE, i am automating Flex-Webpage using Selenium(Java Eclipse).

3. Can i able to upgrade this 1.0.1 to the latest?

Whether "Settings.OcrTextSearch = True " settings is for IDE or Eclipse?

How to turn on Text feature in Eclipse-Java?

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

You SHOULD upgrade your SikuliX to version 1.1.1 of course.

At the Java level the respective class is:
org.sikuli.basics.Settings

and the mentioned settings are public static attributes in there.

see:
https://raiman.github.io/SikuliX-2014/javadocs/index.html

Revision history for this message
vignesh (vigneshtr) said :
#7

Updated to sikuli 1.1.1.

imported "org.sikuli.basics.Settings".

made the function to "static" as you suggested.

The command "screen.find("some text")" throws

[error] Region.find(text): text search is currently switched off
Exception in thread "main" FindFailed: Text search currently switched off
  Line 1671, in file Region.java

Kindly help me to get rid of this error.

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

I didn't say anything about making "functions static"

You have to do on the Java level, what was mentioned in comment #4 for the scripting level:
Settings.OcrTextSearch = true;

before using the method
find("some text");

Revision history for this message
vignesh (vigneshtr) said :
#9

Thanks RaiMAn,

I have added "Settings.OcrTextSearch = true;"

But i got the following error.

[error] TextRecognizer: init: tessdata folder not found at C:/Sikuli/libs/
[error] Region.find(text): text search is now switched offException in thread "main"
FindFailed: Text search currently switched off
  Line 1671, in file Region.java

Note: i have updated sikuli to 1.1.1 with 3rd option enabled.

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

Take care that you are running a clean version 1.1.1 and not addressing any parts of older versions.

the tessdata folder should not be searched in C:/Sikuli/libs with version 1.1.1.

see the docs:
http://sikulix-2014.readthedocs.io/en/latest/basicinfo.html#sikulix-system-specifics

Revision history for this message
vignesh (vigneshtr) said :
#11

Yes, I am using clean the version 1.1.1.

Deleted the libs folder in C:/Sikuli. Then tried running the script. libs folder created without "tessdata" folder. So faced same issue mentioned in #9

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

if a libs folder is created in C:/Sikuli, then you are not using 1.1.1

see comment #10

Revision history for this message
vignesh (vigneshtr) said :
#13

oh..then that was my fault..

I was doing well with sikuli 1.0.1 upto now. For OCR Text feature, i am trying to migrate from 1.0.1 to 1.1.1.

Steps i did to upgrade:

1: Copied latest sikulisetup-1.1.1 jar to existing C:/Sikuli.
2. Ran sikulisetup-1.1.1 jar file and selected 2nd(Eclipse) and 3rd (OCR feature) options.
3. Downloaded the suggested jar files freshly during installation. Installation was successful.
4. In Eclipse project(where my script was present) removed 1.0.1 sikuli set up file and added sikulisetup-1.1.1 file.

If anything wrong in this, please help me to do a proper upgrade to 1.1.1.

Thanks in advance.

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

when using the Java API, the project must reference one of the setup-result-jars - usually sikulixapi.jar

http://www.sikulix.com/quickstart/#qs8

Can you help with this problem?

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

To post a message you must log in.