April 3, 20196 yr Hey guys, I use Selenium to recover and create accounts but I have a lot of fails where the captcha is solved but upon continuing to the next page, the page just refreshes. Does anyone know what happens here or has any experience in completing this process by the same means? Thanks!
April 3, 20196 yr 2 minutes ago, Zummy said: Hey guys, I use Selenium to recover and create accounts but I have a lot of fails where the captcha is solved but upon continuing to the next page, the page just refreshes. Does anyone know what happens here or has any experience in completing this process by the same means? Thanks! 1) Make sure your proxies aren't blocking the recaptcha from loading (Inspect and look at errors) 2) Use this to inject the captcha response: JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("document.getElementById(\"g-recaptcha-response\").innerHTML=\""+response+"\";"); 3) make sure you're submitting the form and not clicking it if(isElementPresent(driver, By.id("password-recovery-form"))){ driver.findElement(By.id("password-recovery-form")).submit(); }
April 3, 20196 yr Author 8 minutes ago, Naked said: 1) Make sure your proxies aren't blocking the recaptcha from loading (Inspect and look at errors) 2) Use this to inject the captcha response: 3) make sure you're submitting the form and not clicking it Thanks for the reply! I'm using the same technique: RemoteWebDriver r = (RemoteWebDriver) driver; String setResponseToken = "document.getElementById('g-recaptcha-response').innerHTML='" + CAPTCHA + "'"; r.executeScript(setResponseToken); r.executeScript("onSubmit()"); What anti captcha service do you use?
April 3, 20196 yr 1 minute ago, Zummy said: Thanks for the reply! I'm using the same technique: RemoteWebDriver r = (RemoteWebDriver) driver; String setResponseToken = "document.getElementById('g-recaptcha-response').innerHTML='" + CAPTCHA + "'"; r.executeScript(setResponseToken); r.executeScript("onSubmit()"); What anti captcha service do you use? anticaptcha Did you verify the captcha is loading?
April 3, 20196 yr Author 1 minute ago, Naked said: anticaptcha Did you verify the captcha is loading? I'm also using anticaptcha, what's your fail-rate? No I don't verify if it has been loaded, can I check for certain HTML elements to verify if it's loaded? I don't think it's proxy related, sometimes it does and sometimes it doesn't complete the captcha with the same proxy.
April 3, 20196 yr 14 minutes ago, Zummy said: I'm also using anticaptcha, what's your fail-rate? No I don't verify if it has been loaded, can I check for certain HTML elements to verify if it's loaded? I don't think it's proxy related, sometimes it does and sometimes it doesn't complete the captcha with the same proxy. Failure rate is low (not sure on actual number). Should always check if it's loaded. You can do this by looking for the element. Google captcha likes to misbehave when using a SOCKS connection
April 3, 20196 yr 49 minutes ago, Naked said: Failure rate is low (not sure on actual number). Should always check if it's loaded. You can do this by looking for the element. Google captcha likes to misbehave when using a SOCKS connection how come you use anti-captcha over 2captcha? Is the price point different?
April 3, 20196 yr 6 minutes ago, Impensus said: how come you use anti-captcha over 2captcha? Is the price point different? No reason tbh
April 3, 20196 yr # Login form handler runescape.com def runescape_login(driver, username, password): # On runescape account login screen print("On the login page") username_field = driver.find_element_by_id("login-username") password_field = driver.find_element_by_id("login-password") print("Placing log in credentials") if username not in username_field.text: username_field.clear() print("Filling username data") username_field.send_keys(username) print("Filling password data") password_field.send_keys(password) if runescape_site_key in driver.page_source: # Generates the captcha token and executes javascript print("RecaptchaV2") captcha_id = get_captcha_id(runescape_login_url, runescape_site_key) captcha_token = get_captcha_token(captcha_id) driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML = '" + captcha_token + "'; onSubmit();") time.sleep(3) pass else: print("Clicking the login button") driver.find_element_by_id("du-login-submit").click()
April 3, 20196 yr 2 hours ago, Zummy said: Hey guys, I use Selenium to recover and create accounts but I have a lot of fails where the captcha is solved but upon continuing to the next page, the page just refreshes. Does anyone know what happens here or has any experience in completing this process by the same means? Thanks! Also just a side note, I’d recommend ditching selenium and running the script over post/get requests instead as it will be far more lightweight.
April 4, 20196 yr Author Thanks for all the replies guys! If I understand this correctly, as long as the sitekey is present in the page source, recaptcha is loaded? 9 hours ago, Impensus said: Also just a side note, I’d recommend ditching selenium and running the script over post/get requests instead as it will be far more lightweight. I did that in the beginning until they changed to invisible captcha's. I don't know much about HTTP requests and calling functions while doing so (onSubmit()), so I changed it all to Selenium.
April 4, 20196 yr i use anticaptcha and have the same problem, basically anticapcha just shits the bed and gives the wrong value.
April 4, 20196 yr 7 hours ago, Zummy said: Thanks for all the replies guys! If I understand this correctly, as long as the sitekey is present in the page source, recaptcha is loaded? I did that in the beginning until they changed to invisible captcha's. I don't know much about HTTP requests and calling functions while doing so (onSubmit()), so I changed it all to Selenium. Basically how 2captcha works(not sure if anti captcha is the same) is that you send a request for a url with their site key. 2captcha use this to generate a captcha on their end and send you the ID of this captcha. You send a request for it to be solved and given the token back. To answer your question, every site that has recaptcha must have a site key and this must be present somewhere in the source. and I’d say it’s worth giving http requests a look. I had no clue about them either until I tried it and a bit of trial and error got it working.
April 9, 20196 yr On 4/3/2019 at 11:34 PM, Chris said: # Login form handler runescape.com def runescape_login(driver, username, password): # On runescape account login screen print("On the login page") username_field = driver.find_element_by_id("login-username") password_field = driver.find_element_by_id("login-password") print("Placing log in credentials") if username not in username_field.text: username_field.clear() print("Filling username data") username_field.send_keys(username) print("Filling password data") password_field.send_keys(password) if runescape_site_key in driver.page_source: # Generates the captcha token and executes javascript print("RecaptchaV2") captcha_id = get_captcha_id(runescape_login_url, runescape_site_key) captcha_token = get_captcha_token(captcha_id) driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML = '" + captcha_token + "'; onSubmit();") time.sleep(3) pass else: print("Clicking the login button") driver.find_element_by_id("du-login-submit").click() Thank you so much! Was trying to get mine to work for the past few days, I realized my mistake was with the javascript, I didn't add onSubmit(); after I I fill everything else in!
Create an account or sign in to comment