开发者

error 'dict' object is not callable when I use 2captcha api to solve recaptcha invisible

开发者 https://www.devze.com 2022-12-07 22:01 出处:网络
I am using 2captcha API to resolve Recaptcha V2 Invisible for my auto browsing. I have consulted and followed the instructions on the 2captcha homepage, youtube, and the StackOverflow community. Now a

I am using 2captcha API to resolve Recaptcha V2 Invisible for my auto browsing. I have consulted and followed the instructions on the 2captcha homepage, youtube, and the StackOverflow community. Now after running I got a response and showed the results but can't verify the captcha. Can anybody please help me to find what I need to do to submit after the solved captcha code placed?

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webd开发者_Go百科river.common.proxy import *
from time import sleep
import time
import openpyxl
import requests
import pandas as pd

from solveRecaptcha import solveRecaptcha

# Load the Excel file
df = pd.read_excel('file.xlsx')

# Loop through the rows of the DataFrame
for index, row in df.iterrows():
    # Print the current row
    print('Current row: /n', row)
    
    # Do your processing here
    username = row['Name']
    password = row['Pass']

    # Create a new instance of the webdriver with the updated capabilities
    # Use selenium to log in with the username and password
    driver = webdriver.Chrome('./chromedriver')
    driver.get("https://www.reddit.com/account/register/")
    driver.find_element(By.XPATH, "/html/body/div/main/div[1]/div/div[2]/form/fieldset[2]/button").click()
    sleep(3)
    driver.find_element(By.XPATH, "/html/body/div/main/div[2]/div/div/div[2]/div[1]/form/fieldset[1]/input[2]").send_keys(username)
    driver.find_element(By.CSS_SELECTOR, "input#regPassword").send_keys(password)
    sleep(10)

    result = solveRecaptcha(
        "6LeTnxkTAAAAAN9QEuDZRpn90WwKk_R1TRW_g-JC",
        "https://www.reddit.com/account/register/",
    )
    print(result)

    sleep(10)

    code = result('code')

    WebDriverWait(driver, 10).until(
        EC.presence_of_all_elements_located((By.ID, 'g-recaptcha-response'))
    )

    driver.execute_script(
        "document.getElementByID('g-recaptcha-response').innerHTML = " + "'" + code + "'")


    driver.find_element(By.ID, "recaptcha-verify-button").click()

    sleep(77)


everyone, after getting help from @John Gordon then I know my mistake. Thank you, John!

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.proxy import *
from time import sleep
import time
import openpyxl
import requests
import pandas as pd

from solveRecaptcha import solveRecaptcha

# Load the Excel file
df = pd.read_excel('file.xlsx')

# Loop through the rows of the DataFrame
for index, row in df.iterrows():
    # Print the current row
    print('Current row: /n', row)
    
    # Do your processing here
    username = row['Name']
    password = row['Pass']

    # Create a new instance of the webdriver with the updated capabilities
    # Use selenium to log in with the username and password
    driver = webdriver.Chrome('./chromedriver')
    driver.get("https://www.reddit.com/account/register/")
    driver.find_element(By.XPATH, "/html/body/div/main/div[1]/div/div[2]/form/fieldset[2]/button").click()
    sleep(3)
    driver.find_element(By.XPATH, "/html/body/div/main/div[2]/div/div/div[2]/div[1]/form/fieldset[1]/input[2]").send_keys(username)
    driver.find_element(By.CSS_SELECTOR, "input#regPassword").send_keys(password)
    sleep(10)

    result = solveRecaptcha(
        "6LeTnxkTAAAAAN9QEuDZRpn90WwKk_R1TRW_g-JC",
        "https://www.reddit.com/account/register/",
    )
    print(result)

    sleep(10)

    code = result['code']

    WebDriverWait(driver, 10).until(
        EC.presence_of_all_elements_located((By.ID, 'g-recaptcha-response'))
    )

    driver.execute_script(
        "document.getElementByID('g-recaptcha-response').innerHTML = " + "'" + code + "'")


    driver.find_element(By.ID, "recaptcha-verify-button").click()

    sleep(77)
0

精彩评论

暂无评论...
验证码 换一张
取 消