【问题标题】:how to procses Cloudflare Turnstile in web driver with selenuim如何使用 selenium 在 webdriver 中处理 Cloudflare Turnstile
【发布时间】:2023-01-30 20:20:46
【问题描述】:

我尝试使用 selenuim 模块来获取某些网站不成功。 这是我尝试的: 未检测到的_chromedriver 添加用户配置文件 使用代理服务器。 当我用 webdriver 打开它时,Cloudflare 不允许我处理。 当我用普通 chrom 打开它时,它工作正常。 有idias吗?

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from datetime import datetime
import time
from undetected_chromedriver import Chrome

now = datetime.now()
current_time = now.strftime("%H:%M:%S")
print('Hey Elior, im on = ', current_time)

options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\Owner\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 12")

driver = Chrome(chrome_options=options)
driver.get("https://www.example.com")

def login():
    driver.get("site")
    # identify username, password and signin elements
    time.sleep(1)
    driver.find_element(By.NAME, "username").click()
    driver.find_element(By.NAME, "username").send_keys('')

    time.sleep(1)
    driver.find_element(By.NAME, "password").click()
    driver.find_element(By.NAME, "password").send_keys('')

    time.sleep(1)
    # press on login button
    driver.find_element(By.ID, "login-submit").click()

    driver.maximize_window()
    driver.execute_script("console.clear()")  # clean the console
    time.sleep(3)

【问题讨论】:

    标签: python selenium webdriver


    【解决方案1】:

    您可以尝试使用Selenium-Profiles

    请注意,headless 几乎永远不会在未被发现的情况下工作。

    【讨论】:

      猜你喜欢
      • 2012-04-14
      • 1970-01-01
      • 1970-01-01
      • 2016-04-01
      • 2013-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-11
      相关资源
      最近更新 更多