Sunday, January 24, 2016

SIKULI- HOW TO FETCH/EXTRACT TEXT FROM AN IMAGE || HOW TO GET TEXT FROM CAPTCHA IMAGE

SIKULI- HOW TO FETCH/EXTRACT/GET TEXT FROM A TEXT CAPTCHA IMAGE

If you are Automating an Application which has a submit FORM with TEXT CAPTCHA IMAGE, it is really tough to deal with it with tools like SELENIUM or any other software testing tools. SIKULI which is an IMAGE based tool , helps a lot to deal with this kind of situation.

Lets see the below form taken from a recruitment website:

GET EXTRACT FETCH TEXT FROM CAPTCHA IMAGE
Sample Recruitment FORM to Submit CV
Here is the small code to get text of CAPTCHA IMAGE in a variable :

GET EXTRACT FETCH TEXT FROM CAPTCHA IMAGE
Small Code To Capture Text from Captcha Image
Here is the output received from Sikuli script:



The same output can be populated to the CAPTCHA edit box to complete the test.

In order to get Image Text feature enabled in the Sikuli, user has to navigate to File>>Preferences>>more options>>check both option i.e. "allow searching for text" and "allow OCR" ON

you can copy the code mentioned below.please replace "test.png" with your captcha image screen shot in the below mentioned code:
a=find(test.png).text()
print a

No comments:

Post a Comment