java - 如何使用 java 使用 WebDriver 创建新的 google 帐户期间读取图像框中的文本

标签 java selenium-webdriver captcha

如何在 Java 中使用 WebDriver 创建新的 Google 帐户时读取图像框中的文本。我正在使用 Java 中的 WebDriver 创建一个新的 Gmail 帐户。我无法阅读图像框中存在的文本。有人可以帮我解决这个问题吗?

我使用的代码是:

driver = new InternetExplorerDriver();
driver.get("http://gmail.com");
Thread.sleep(10000);
driver.findElement(By.id("link-signup")).click();
Thread.sleep(10000);
driver.findElement(By.id("FirstName")).sendKeys("Swamy");
driver.findElement(By.id("LastName")).sendKeys("Kumar");
driver.findElement(By.id("GmailAddress")).sendKeys("Skumar081112");
driver.findElement(By.id("Passwd")).sendKeys("Swamy@123");
driver.findElement(By.id("PasswdAgain")).sendKeys("Swamy@123");
driver.findElement(By.xpath("//label[@id='month-label']/span/div
                         /div")).sendKeys("November");
driver.findElement(By.id("BirthDay")).sendKeys("16");
driver.findElement(By.id("BirthYear")).sendKeys("1978");
driver.findElement(By.xpath("//div[@id='Gender']/div/div")).sendKeys("Male");
driver.findElement(By.id("RecoveryPhoneNumber")).sendKeys("9000000000");
driver.findElement(By.id("RecoveryEmailAddress")).sendKeys("abc@gmail.com");
driver.findElement(By.id("HomepageSet")).click();
String imgmsg = driver.findElements(By.xpath("//div[@id='recaptcha_image']
                 /img")).toString();
System.out.println(imgmsg);

我们将不胜感激...

最佳答案

你不能

该文本称为 CAPTCHA它旨在阻止自动化系统创建帐户(并且显然做得相当不错)。

A CAPTCHA (pron.: /ˈkæp.tʃə/) is a type of challenge-response test used in computing as an attempt to ensure that the response is generated by a human being. The process usually involves a computer asking a user to complete a simple test which the computer is able to grade. These tests are designed to be easy for a computer to generate but difficult for a computer to solve, but again easy for a human. If a correct solution is received, it can be presumed to have been entered by a human. A common type of CAPTCHA requires the user to type letters and/or digits from a distorted image that appears on the screen. Such tests are commonly used to prevent unwanted internet bots from accessing websites, since a normal human can easily read a CAPTCHA, while the bot cannot process the image letters and therefore, cannot answer properly, or at all. Although most CAPTCHAs are letter pictures randomly generated, many of them have become difficult even for a human to read , so picture CAPTCHAs were created in which a human is shown a simple test to show a picture of a certain animal (given few animal pictures), which is simple for a human being to process, and therefore easy to pick, while a bot cannot process and solve the question because although it can analyze the picture, it cannot easily guess the animal. The term "CAPTCHA" was coined in 2000 by Luis von Ahn, Manuel Blum, Nicholas J. Hopper, and John Langford (all of Carnegie Mellon University). It is an acronym based on the word "capture" and standing for "Completely Automated Public Turing test to tell Computers and Humans Apart". Carnegie Mellon University attempted to trademark the term on 15 October 2004,1 but the trademark application was abandoned on 21 April 2008.[2] A CAPTCHA is sometimes described as a reverse Turing test, because it is administered by a machine and targeted at a human, in contrast to the standard Turing test that is typically administered by a human and targeted at a machine.

关于java - 如何使用 java 使用 WebDriver 创建新的 google 帐户期间读取图像框中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16539410/

相关文章:

c# - 如何将刷新按钮添加到 mscaptcha 组件?

security - 英文验证码对于其他国家的人来说会是一个问题吗?

JavaFX - 通过 CSS 在按钮之间添加空间

java - 如何向我的 Java Servlet 的现有 HttpServletRequest 添加参数?

java - 无法使用 selenium 读取 <h3> 下的 <p> 文本

java - 使用 selenium webdriver 计算网格中的行数

Java boolean 标志的排列组合

java - 部署错误 :Starting of Tomcat failed, 服务器端口 8080 已被使用

java - 无法与 Instagram 登录字段交互

php - 新的 Google ReCaptcha 未发布/接收 'g-recaptcha-response'