Defiled 415 Share Posted March 1, 2020 (edited) Hello, This is a snippet on solving 2Captcha using Selenium, you of course need 3 classes to use this (HttpWrapper, TwoCaptchaService, ProxyType) which are found in the 2Captcha Java API. private void solveCaptcha(String apiKey, String pageUrl, String siteKey) { TwoCaptchaService service = new TwoCaptchaService(apiKey, siteKey, pageUrl); try { String responseToken = service.solveCaptcha(); if(responseToken.equals("ERROR_CAPTCHA_UNSOLVABLE")) { System.out.println("Unable to solve.. Resolving.. "); solveCaptcha(apiKey, pageUrl, siteKey); } else { System.out.println("Solved and Generated Response Token.. "+responseToken); JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("document.getElementById('g-recaptcha-response').innerHTML = '" + responseToken + "';"); js.executeScript("onSubmit()"); } } catch (IOException e) { e.printStackTrace(); } } If the page does not contain the callback function onSubmit() or contains it but within an anonymous function, you have 2 ways to do it: /* Using the Browser console find the lettering that points to the anonymous function and replace cl.J with yours. */ js.executeScript("___grecaptcha_cfg.clients[0].cl.J.callback(\"" + responseToken + "\")"); OR /* This simply calls back any callback method it finds. */ js.executeScript("document.getElementById('callback').call();"); I hope this helps someone improvements are welcome Edited March 1, 2020 by Defiled typos m4rr3co and yeeter 1 1 Link to comment Share on other sites More sharing options...
Eclipseop 194 Share Posted March 1, 2020 hello Good squire! I am here to inform u that using selenium is so 2017 l00l Link to comment Share on other sites More sharing options...
Defiled 415 Author Share Posted March 2, 2020 (edited) 11 hours ago, Eclipseop said: hello Good squire! I am here to inform u that using selenium is so 2017 l00l It's open for anyone to use, Mr. Otter. If you wanna use Selenium, go for it.. If you wanna use Apache HTTP go for it.. if you wanna use a Toaster go for it.. PST: The same code can be applied to other software... you just have to change the way it executes the Javascript code. Kind Regards, The Good Squire Edited March 2, 2020 by Defiled Link to comment Share on other sites More sharing options...
kamilo 7 Share Posted May 3, 2020 On 3/2/2020 at 2:03 AM, Defiled said: It's open for anyone to use, Mr. Otter. If you wanna use Selenium, go for it.. If you wanna use Apache HTTP go for it.. if you wanna use a Toaster go for it.. PST: The same code can be applied to other software... you just have to change the way it executes the Javascript code. Kind Regards, The Good Squire whats the lastest, most efficient methodology rather than using selenium cuz its free there have to be some better cost-efficient methods Link to comment Share on other sites More sharing options...
m4rr3co 67 Share Posted May 9, 2020 On 3/1/2020 at 5:02 PM, Eclipseop said: hello Good squire! I am here to inform u that using selenium is so 2017 l00l what's the 2020 method? x_x Link to comment Share on other sites More sharing options...
m4rr3co 67 Share Posted May 11, 2020 On 3/1/2020 at 11:30 AM, Defiled said: Hello, This is a snippet on solving 2Captcha using Selenium, you of course need 3 classes to use this (HttpWrapper, TwoCaptchaService, ProxyType) which are found in the 2Captcha Java API. private void solveCaptcha(String apiKey, String pageUrl, String siteKey) { TwoCaptchaService service = new TwoCaptchaService(apiKey, siteKey, pageUrl); try { String responseToken = service.solveCaptcha(); if(responseToken.equals("ERROR_CAPTCHA_UNSOLVABLE")) { System.out.println("Unable to solve.. Resolving.. "); solveCaptcha(apiKey, pageUrl, siteKey); } else { System.out.println("Solved and Generated Response Token.. "+responseToken); JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("document.getElementById('g-recaptcha-response').innerHTML = '" + responseToken + "';"); js.executeScript("onSubmit()"); } } catch (IOException e) { e.printStackTrace(); } } If the page does not contain the callback function onSubmit() or contains it but within an anonymous function, you have 2 ways to do it: /* Using the Browser console find the lettering that points to the anonymous function and replace cl.J with yours. */ js.executeScript("___grecaptcha_cfg.clients[0].cl.J.callback(\"" + responseToken + "\")"); OR /* This simply calls back any callback method it finds. */ js.executeScript("document.getElementById('callback').call();"); I hope this helps someone improvements are welcome little doubt, how do you get the "driver" variable inside the function? do you send it as a parameter? Link to comment Share on other sites More sharing options...
Eclipseop 194 Share Posted May 13, 2020 On 5/9/2020 at 7:37 PM, m4rr3co said: what's the 2020 method? x_x maybe one of the bajillions of open source ones xddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd https://github.com/search?q=runescape+account+creator m4rr3co 1 Link to comment Share on other sites More sharing options...
m4rr3co 67 Share Posted May 13, 2020 2 minutes ago, Eclipseop said: maybe one of the bajillions of open source ones xddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd https://github.com/search?q=runescape+account+creator jesus, so many solutions ahahha thanks a bunch bro =D Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now