Prerequisite
git clone https://gitlab.com/nirranjan.raut/fast-captcha-client-library.git
cd fast-captcha-client-library
mvn clean install
git clone https://gitlab.com/nirranjan.raut/fast-captcha-client-library.git
cd fast-captcha-client-library
mvn clean install
1. Register on fast captcha with your email id, mobile number and password of your choice.
2. Activate your account by entering OTP received on email and mobile number.
3. Generate API Secret Key.
4. Import fast-captcha-client-library
in your source code.
<dependency> <groupId>com.fast.captcha</groupId> <artifactId>fast-captcha-client-library</artifactId> <version>1.0.0</version> </dependency>
4. Call Fast Captcha service to solve recaptcha.
com.fast.captcha.model.FastCaptchaResponse response = com.fast.captcha.CaptchaSolver.solve("fast_captcha_api_key", new File("captcha_image_file_location")); if(!"SUCCESS".equals(response.getStatus())) { LOGGER.error("Response is not successful {}", response); throw new RuntimeException("Captcha solution not found."); }
5. Inject obtained recaptcha token or image captcha solution into automated web page.
String solution = response.getSolution(); //enter this solution into the text field WebElement captchaSolutionElement = chromeDriver.findElement(By.id("captchaText")); captchaSolutionElement.sendKeys(solution);
6. Submit the page and done.