I try to solve a captcher from the following standard homepage:
For that I am using the following code:
String apiKey = "CAP-XXX";
String Link = ";;
TwoCaptcha solver = new TwoCaptcha(apiKey);
ReCaptcha captcha = new ReCaptcha();
captcha.setSiteKey("6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-");
captcha.setUrl(";);
captcha.setInvisible(true);
captcha.setAction("verify");
driver = OpenBrowser(); // Opens the browser ;)
driver.get(Link);
wait_own(2000);
try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
I used the API-Key manually within a browser and it works. When I execute the code above I get the following Error within the catch block:
ERROR_WRONG_USER_KEY
My assumption was that my apiKey is not valid, but it works while using it manually at the homepage. Is there any further point that I need to take care about?
Thank you in advance.
I try to solve a captcher from the following standard homepage: https://google.com/recaptcha/api2/demo
For that I am using the following code:
String apiKey = "CAP-XXX";
String Link = "http://google.com/recaptcha/api2/demo";
TwoCaptcha solver = new TwoCaptcha(apiKey);
ReCaptcha captcha = new ReCaptcha();
captcha.setSiteKey("6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-");
captcha.setUrl("https://google.com/recaptcha/api2/demo");
captcha.setInvisible(true);
captcha.setAction("verify");
driver = OpenBrowser(); // Opens the browser ;)
driver.get(Link);
wait_own(2000);
try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
I used the API-Key manually within a browser and it works. When I execute the code above I get the following Error within the catch block:
ERROR_WRONG_USER_KEY
My assumption was that my apiKey is not valid, but it works while using it manually at the homepage. Is there any further point that I need to take care about?
Thank you in advance.
It sounds like the API key might not be linked to the right context or domain. Double-check that your key is configured correctly and ensure you're passing all the necessary session details.
For a quick guide on solving reCAPTCHA v2, check out this doc. Should help clear things up!