javascript - How to fetch value of captcha image using jquery - Stack Overflow

Is there a way that I can get the captcha image value using jqueryjavascript and put it on the validat

Is there a way that I can get the captcha image value using jquery/javascript and put it on the validation box?

Something I want to do on a form like below:

And the code for captcha is written like below:

<td><img id="form_rcdl:j_idt33:j_idt38" src="/rcdlstatus/DispplayCaptcha?txtp_cd=1&amp;bkgp_cd=2&amp;noise_cd=2&amp;gimp_cd=3&amp;txtp_length=5&amp;pfdrid_c=true?1388469581&amp;pfdrid_c=true" alt=""></td>

Is there a way that I can get the captcha image value using jquery/javascript and put it on the validation box?

Something I want to do on a form like below:

And the code for captcha is written like below:

<td><img id="form_rcdl:j_idt33:j_idt38" src="/rcdlstatus/DispplayCaptcha?txtp_cd=1&amp;bkgp_cd=2&amp;noise_cd=2&amp;gimp_cd=3&amp;txtp_length=5&amp;pfdrid_c=true?1388469581&amp;pfdrid_c=true" alt=""></td>
Share Improve this question asked Jul 13, 2018 at 12:09 choudhury smrutiranjan paridachoudhury smrutiranjan parida 2,7485 gold badges30 silver badges40 bronze badges 4
  • 4 If you could do that, then why would captcha ever be used? – bassxzero Commented Jul 13, 2018 at 12:10
  • There is no point in reading captcha at client side and validate it. What exactly you want to achieve here? – Bhushan Kawadkar Commented Jul 13, 2018 at 12:17
  • Yes. That's true. But I am just curious if we can do that. – choudhury smrutiranjan parida Commented Jul 13, 2018 at 12:18
  • I want to automate it in a simple page. – choudhury smrutiranjan parida Commented Jul 13, 2018 at 12:26
Add a ment  | 

1 Answer 1

Reset to default 4

Usually, these kinds of captcha are easy to pass/hack.

Now, this is can be done in different ways using other programming languages. But as you are looking for a client side solution tesseract.js might help.

I have not tried that before, but using it seems straightforward

Tesseract.recognize(myImage)
       .progress(function  (p) { console.log('progress', p)    })
       .then(function (result) { console.log('result', result) })

Here is a demo (On JSFiddle) you can try it (Won't work on StackOverflow ) you should get an alert says road

let progress = document.querySelector('#progress');

Tesseract.recognize('https://image.ibb.co/bXhgST/captcha_5.jpg')
  .progress(function(p) {

    progress.innerHTML += JSON.stringify(p) + "<br>"
  })
  .then(function(result) {
    alert(result.text)
  })
<script src='https://cdn.rawgit./naptha/tesseract.js/1.0.10/dist/tesseract.js'></script>
<img id="img" src="https://image.ibb.co/bXhgST/captcha_5.jpg" />
<div id="progress"></div>

Another option would be using a professional service like Amazon Detecting Text in an Image

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745474804a4629296.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信