简体   繁体   中英

Is it possible to get text from captcha image with Selenium WebDriver using Java?

How can I capture the text from captcha images? Are there any methods? I tried:

String attr = driver.findElement(By.xpath("//*[@id='recaptcha_challenge_image']")).getAttribute("value");
        System.out.println(attr);

No, it's not possible. Captcha image is just that - an image. Unless if you find a text recognition function/method to do it, and a good one for that matter. Captcha should generate an image from text, which is usually stored in a Session variable. You can try and access that instead.

I wrote my own Captcha class because I needed to do Client-Side validation as well (without jQuery).

You cannot.

The whole point of a captcha is that a computer or script can not know what the answer is.

Text on the Captcha cannot be read as it is embedded in an image, there are online softwares for reading text on the Captcha but they are unreliable may not give you the desired results. These software are also known by the name of Optical Character Recognition (OCR) If you wish to try out these software you may search for the followings:

Asprise OCR

Tess4j

Java OCR

if you are Automating Captcha,then it clearly shows that you're defeating captcha.

The purpose of captcha is not to automate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM