Skip to content

Selenium not submitting form with anticaptcha #47

Open
@priteshthaker1501

Description

@priteshthaker1501

@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()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions