[Python] How can I bypass LinkedIn human verification while using selenium to automate...

Discussão em 'Python' iniciado por Stack, Outubro 1, 2024.

  1. Stack

    Stack Membro Participativo

    import time
    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.chrome.options import Options
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC

    chrome_options = Options()
    chrome_options.add_experimental_option("detach", True)
    chrome_options.add_argument("--disable-webrtc")
    chrome_options.add_argument("--disable-features=WebRTC-HW-Decoding,WebRTC-HW-encoding,WebRTC-Support-Local-IP")

    cService =
    webdriver.ChromeService(executable_path=r"C:\Users\quahe\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe")
    driver = webdriver.Chrome(service = cService, options=chrome_options)


    def login_to_linkedin(email, password):
    linkedin_login_url = "https://www.linkedin.com/login"
    driver.get(linkedin_login_url)

    email_field = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.ID, "username"))
    )

    email_field.send_keys(email)

    password_field = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.ID, "password"))
    )

    password_field.send_keys(password)

    login_button = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.XPATH, '//button[@type="submit"]'))
    )

    login_button.click()

    time.sleep(4)

    new_url= driver.current_url
    driver.get(new_url)

    verify_button = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, '//*[@id="home_children_button"]')))
    verify_button.click()


    After submitting my login details I get the human verification popup, and when I try to automate the verification by clicking on the verify button the page just loads again and shows the same thing.

    Continue reading...

Compartilhe esta Página