简体   繁体   中英

Is it possible to automate captcha code using selenium webdriver?

I'm automating this irctc site as hands on selenium webdriver.

It is asking me for captcha code along with username and password. Is there anyway to automate the captcha code?

1.try import this javasc ocr lib or other ocr lib. https://github.com/antimatter15/ocrad.js

2.read the result and pick only upper case char

There is no proper way to automate captcha using Selenium WebDriver. The only way to run an automated test script involving captcha is to have sufficient delay when the captcha appears so that a human can enter it on the field provided.

You obviously failed to understand what CAPTCHA is; from WikiPedia :

A CAPTCHA (a backronym for "Completely Automated Public Turing test to tell Computers and Humans Apart") is a type of challenge-response test used in computing to determine whether or not the user is human.

As was already mentioned in other answers and comments, there are several possible attacks to defeat this. You can get links to several other options from the same WikiPedia page . But note that all of these are more of a proof-of-concept, rather than an out-of-the-box solution.

Since you tagged your question with Selenium, it is possible that you may be using this in an environment that you control , such as test environment at your work. In such a scenario, the easiest solution is to ask your developers to introduce a "test" flag for any non-production deployments. When this flag is active, a predefined phrase will always pass the CAPTCHA for testing purposes. However, you should still have a full-pass test, with everything turned on as if real production.

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