http://seleniumworks.blogspot.kr/2013/09/handling-captcha-webdriver.html

Make use of the 'input' tag with type 'hidden' in-order to handle Captcha.

Look at this example for reference..

 

driver.get("http://www.google.com/recaptcha/learnmore");
driver.switchTo().frame(0); //calling iframe with no id
JavascriptExecutor js = (JavascriptExecutor) driver;  
//Setting the captcha values  
js.executeScript("document.getElementsByName('recaptcha_challenge_field')[0].setAttribute('value','03AHJ_Vuv4tV3FrmUHbImL9JPkWJNqs1KDbFdKfG1jhqa2Uhl4U1vzLxXtZMMkZoAHuVCXA1js3GiaaQJ-zqyuledzZP-PEOV-y_Fx87-U6HVu4nh8kfwPzfPU50yEV5oscb20ptwMGR5EEoAtE8dfAlwCVejJtP779upzfAqn_ID5IQJ2F9Nw218')");
driver.findElement(By.name("recaptcha_response_field")).sendKeys("23129555894");
driver.findElement(By.name("Button1")).click();

Note: setAttribute plays a major role here.

 

3 comments:

  1. Hi Prasanth,

    Is there anyway to type captcha text without typing 23129555894 other than OCR.

    Reply

     
     
  2. Hi 
    I do the same what you write but it shows incorrect Captcha.

    Reply

     
     
  3. from where you got this value or why we are entering this 23129555894 ?

    Reply

最新文章

  1. python排序之一插入排序
  2. 如何为CriteriaOperator过滤对象转换为lambda表达式,即:linq to xpo的动态where语句
  3. Notepad++进行php开发所必需的插件
  4. iOS两种方式加载图片的区别
  5. 高效能人士必知铁律--note
  6. 代码创建storyboard
  7. MySQL指令记录(Wampserve环境)
  8. dojo.declare
  9. Class constructor
  10. position relative和absolute区别
  11. win7下让程序默认以管理员身份运行
  12. 图表工具--- ECharts.js学习(一) 简单入门
  13. 给定桩号获取纵断面中的高程值(c# for civil3d)
  14. Map、Set、List区别
  15. 自定义panel实现,并实现item更改和移除动画。
  16. scrollIntoView() 调用元素就可以出现在视窗中
  17. 第一册:lesson ninety-three。
  18. java——IO流01
  19. js-杂记
  20. Python 字典 dict() 函数

热门文章

  1. python如何保证多个线程同时修改共享对象时不出错!
  2. 教务处sso设计缺陷
  3. jqGrid使用整理
  4. oracle 解析json格式
  5. get获取Json
  6. 浅谈MAIC 2016第二届移动应用(APP)创新大会
  7. hdu_5919_Sequence II(主席树)
  8. 4、Hibenrate中HQL的10中查询方式
  9. Traffic Ccontrol(流量控制)
  10. Spring contextConfigLocation默认加载文件的位置