Jak odczytać tekst z obrazka (captcha) za pomocą Selenium WebDriver z Javą

Mam stronę rejestracyjną, ale w ostatnim captcha wyświetla się ..

Nie mogę odczytać tekstu z obrazu. Wspomnę kod i dane wyjściowe ..

@Test
public void loginTest() throws InterruptedException {
    System.out.println("Testing");
    driver.get("https://customer.onlinelic.in/ForgotPwd.htm");

    WebElement element = driver.findElement(By.xpath("//*[@id='forgotPassword']/table/tbody/tr[5]/td[3]/img"));
    System.out.println(" get the instance ");

    String elementTest = element.getAttribute("src");
    System.out.println("Element : " + elementTest);
}

Wyjście: błąd

Wyjątek w wątku „main” org.openqa.selenium.NoSuchElementException: Nie można zlokalizować elementu: {„method”: „xpath”, „selector”: ”//[@ id = 'forgotPassword'] / table / tbody / tr [5] / td [3] / img "} Czas trwania polecenia lub limit czasu: 60,02 sekund Dokumentacja tego błędu znajduje się na stronie:http://seleniumhq.org/exceptions/no_such_element.html Informacje o kompilacji: wersja: „2.35.0”, wersja: „8df0c6b”, czas: „2013-08-12 15:43:19” Informacje o systemie: os.name: „Windows 7”, os.arch: „amd64” , os.version: '6.1', java.version: '1.6.0_26' Identyfikator sesji: 5f5b2e1a-56a4-49ad-8fd3-2870747a7768 Informacje o sterowniku: Możliwości org.openqa.selenium.firefox.FirefoxDriver [{platforma = XP, acceptSslCerts = true, javascriptEnabled = true, browserName = firefox, rotatable = false, locationContextEnabled = true, wersja = 23.0.1, cssSelectorsEnabled = true, databaseEnabled = true, handlesAlerts = true, browserConnectionEnabled = true, nativeEvents = true, webStorageEnabled = true, nativeEvents = true, webStorageEnabled = true, nativeEvents = true, webStorageEnabled = true, applicationCacheEnabled = true, applicationCacheEnabled = true, applicationCacheEnabled = true, applicationCacheEnabled = true, takesScreenshot = true}] w sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Metoda natywna) w sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:39) w sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.newInstance) (DelegatingConstructorAccessorImpl.newInstance) at java.lang.reflect.Constructor.newInstance (Constructor.java:513) w org.openqa.selenium.remot e.ErrorHandler.createThrowable (ErrorHandler.java:191) w org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed (ErrorHandler.java:145) w org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:554) w org.openqa.selenium.remote.RemoteWebDriver.findElement (RemoteWebDriver.java:307) w org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath (RemoteWebDriver.java:404) w org.openqa.selenium.By $ ByXPath.findElement (By.java:344) w org.openqa.selenium.remote.RemoteWebDriver.findElement (RemoteWebDriver.java:299) w seleniumtest.CaptchaTest.loginTest (CaptchaTest.java:41) w seleniumtest.CaptchaTest.main (CaptchaTest.java: 59) Przyczyna: org.openqa.selenium.remote.ErrorHandler $ UnknownServerException: Nie można zlokalizować elementu: {"method": "xpath", "selector": "//[@ id = 'forgotPassword'] / table / tbody / tr [5] / td [3] / img "} Informacje o kompilacji: wersja: '2.35.0', wersja: '8df0c6b', czas: '2013-08- 12 15:43:19 'Informacje o systemie: os.name:' Windows 7 ', os.arch:' amd64 ', os.version:' 6.1 ', java.version:' 1.6.0_26 'Informacje o sterowniku: driver.version : nieznane w .FirefoxDriver.prototype.findElementInternal_ (plik: /// C: /Users/lukup/AppData/Local/Temp/anonymous4043037924964932185webdriver-profile/extensions/[email protected]/components/driver_component.js: 8880) at. fxdriver.Timer.prototype.setTimeout / <.notify (plik: /// C: /Users/lukup/AppData/Local/Temp/anonymous4043037924964932185webdriver-profile/extensions/[email protected]/components/driver_component.js: 396)

questionAnswers(8)

yourAnswerToTheQuestion