python-anticaptcha
python-anticaptcha copied to clipboard
Selenium not submitting form with anticaptcha
@ad-m I really tried hard using your code with selenium and chrome. I want to login on https://services.aig.co.il/PersonalServices/#/login;url=%2Fhome
when I'm trying to login after some attempts there is Recaptcha and I have API_KEY and SITE_KEY. I got a token using website_url and site_key. but still, a successful login is not working.
api_key = "**********************"
client = AnticaptchaClient(api_key)
def get_token(website_url, site_key, invisible):
task = NoCaptchaTaskProxylessTask(
website_url=website_url,
website_key=site_key,
is_invisible=invisible
)
job = client.createTask(task)
job.join()
return job.get_solution_response()
I got token succesfull but I don't know what is not woking when i'm trying to submit form.
site_key = "6LcJ8QgUAAAAAB_VRlbua73AhNAp7b6AVLw-cORX"
__SITE_HOME_PAGE_FOR_CRAWLING = 'https://services.aig.co.il/PersonalServices/#/login;url=%2Fhome'
print("Found site-key", site_key)
invisible_captcha = False
token = get_token(__SITE_HOME_PAGE_FOR_CRAWLING, site_key, invisible_captcha)
print("Found token", token)
print("Received challenge-response")
# Inject response in webpage
current_user_driver.execute_script('document.getElementById("g-recaptcha-response").innerHTML = "%s"' % token)
# submit form
login_form = WebDriverWait(current_user_driver, 10).until(
EC.presence_of_element_located((By.CLASS_NAME, "login__form")))
submit_button = WebDriverWait(login_form, 10).until(
EC.element_to_be_clickable((By.CLASS_NAME, "login__form__button")))
submit_button.click()
Can you provide the correct values in the form? I tried to fill it in, but I can't figure out any ID because I don't know the system.
I write below notes in this area:
driver.get(site_url)
script = '''
// Not always form captcha-protected
if(document.getElementById("g-recaptcha-response")) {{
document.getElementById("g-recaptcha-response").innerHTML = "{0}";
}};
'''.format(token);
driver.execute_script(script)
driver.find_element(By.XPATH, '//input[@formcontrolname="custId"]').send_keys("??")
driver.find_element(By.XPATH, '//input[@formcontrolname="custPhone"]').send_keys(
"0528880337"
)
driver.find_element(By.XPATH, '//input[@formcontrolname="custId"]').click()
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.CLASS_NAME, "login__form"))
).click()
submit_button = WebDriverWait(login_form, 10).until(
EC.element_to_be_clickable((By.CLASS_NAME, "login__form__button"))
).click()
Closed due submitter inactivity. Feel free to write comment and ask to reopen if you have still that issue.
Hey @ad-m! I've been trying to make it work on the website http://servicos.dnit.gov.br/multas/LogIn but without success...
I was able to get the sitekey and to find the .
However, I cannot make the form submit after I add the token to this textarea.
Do you have any clue to help me here?
Please provide any valid form data. I am not from the same country as you and I cannot guess these values.
I have same problem. On site that i trying break captcha, don´t have form , just have same
URL
ULR = https://www.nike.com.br/Snkrs/Produto/Air-Max-1-Premium/153-169-211-208971
@ScrimForever , could you share on what operation on nike.com.br do you notice that issue? I was attempt to reproduce captcha, but i don't know when it's triggered.
If you're still struggling, hmu on discord @ Paulie#2222
problem solved see #92