I am trying to automate the captcha using the below code I am getting an error Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages!
WebElement captchaElement = driver.findElement(By.xpath("//img[@alt='captcha']"));
File scr = captchaElement.getScreenshotAs(OutputType.FILE);
String path = (".\\ScreenShots\\" + "captcha-" + jLib.getSystemDateInFormat() + ".png");
FileHandler.copy(scr, new File(path));
Thread.sleep(2000);
ITesseract image = new Tesseract();
image.setDatapath("C:\\Program Files (x86)\\Tesseract-OCR\\tessdata\\eng.traineddata");
String str = image.doOCR(new File(path));
System.out.println("image OCR : " + str);
I am trying to read the text present in the captcha image but I am unable to do that