python-anticaptcha icon indicating copy to clipboard operation
python-anticaptcha copied to clipboard

Submit form with selenium

Open kselight opened this issue 4 years ago • 6 comments

@ad-m I use selenium with chromedriver. I would like to login here: https://listen.tidal.com/login

Actually I get a resolve token from the anti-captcha service and I can insert it into the website, but I can´t submit the form.

def loginTidal(driver, counter):
    global accounts
    tempDetails = accounts[counter].split(':')
    # driver.get("http://tidal.com/login")
    driver.get("https://tidal.com/")
    driver.implicitly_wait(5)
    driver.find_element_by_class_name(
        "btn-link.btn-medium.font-weight-normal.hidden-sm-max"
    ).click()
    time.sleep(2)
    WebDriverWait(driver, 120).until(
        EC.presence_of_element_located(
            (By.CLASS_NAME, "form-input.client-input"))).send_keys(tempDetails[0])
    time.sleep(3)
    url=driver.current_url
    client = AnticaptchaClient(api_key)
    task = NoCaptchaTaskProxylessTask(url, site_key)
    job = client.createTask(task)
    job.join()
    response = job.get_solution_response()
    print("Received solution", response)
    driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML='{}';".format(response))

    time.sleep(2)
    driver.find_element_by_xpath("/html/body/div[1]/div[2]/div[3]/div/div/div/div[1]/div[1]/div/form").submit()
    time.sleep(2)
    password=WebDriverWait(driver, 120).until(
        EC.presence_of_element_located(
            (By.ID, "password"))).send_keys(tempDetails[1])
    WebDriverWait(driver, 120).until(
        EC.presence_of_element_located(
            (By.CLASS_NAME, "position-relative.fullwidth.margin-bottom-1.btn-success.btn-client-primary"))).click()

The problem is that a image challenge occur after I inserted an email in the form. Do you have an idea to solve my problem?

kselight avatar Apr 15 '20 07:04 kselight

Hello,

I have developed a solution for Tidal. The code is available on: https://github.com/ad-m/python-anticaptcha/blob/tidal/examples/real-cases/tidal.py

In case of problems - let me know. I hope it will help your problem.

I wonder why you need to use Selenium? What other operations do you perform at Tidal?

Greetings,

ad-m avatar Apr 20 '20 00:04 ad-m

Hello, thanks for your example. Actually it does not work. grafik After hitting the first button the captcha challenge occurs.

This is the thrown exception from python. grafik

Kind regards

kselight avatar Apr 20 '20 13:04 kselight

Thank you for the information. I will try to run it using Chrome tomorrow. In the case of Firefox I have not encountered such problems. Can you try in Firefox?

ad-m avatar Apr 20 '20 13:04 ad-m

Hello, I have tried it in Firefox, but the same problem occurs. Additionally Selenium with geckodriver has no DRM-support out of the box. Chrome would be better.

kselight avatar Apr 20 '20 16:04 kselight

I think solution with callback sniffer should solve you issue. See https://github.com/ad-m/python-anticaptcha/blob/master/examples/recaptcha_selenium_callback.py . Let's me know if you have issue in integration it.

ad-m avatar Jun 21 '20 09:06 ad-m

problem solved see #92

fashan7 avatar Aug 23 '21 01:08 fashan7