selenium怎么过检测,某手会检测到,不给数据
import timefrom selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
# 配置Chrome选项
opt = Options()
opt.add_experimental_option('detach', True)
opt.add_argument("disable-blink-features=AutomationControlled")
# opt.add_argument("--headless")# 添加无头模式选项(可选)
# 使用Chrome DevTools Protocol来降低被检测风险
opt.add_argument('--disable-blink-features=AutomationControlled')
opt.add_argument('--disable-blink-features=AutomationControlled')
opt.add_experimental_option("excludeSwitches", ["enable-automation"])
opt.add_experimental_option('useAutomationExtension', False)
opt.add_argument('--disable-extensions')
opt.add_argument('--disable-plugins-discovery')
opt.add_argument('--start-maximized')
# 创建Chrome WebDriver实例
web = Chrome(options=opt)
# 修改navigator.webdriver属性
web.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source": """
Object.defineProperty(navigator, 'webdriver', {
get: () => undefined
})
"""
}) 用浏览器就行了,没必要用selenium 熊猫拍板砖 发表于 2023-10-8 21:23
用浏览器就行了,没必要用selenium
想练习selenium的 用微软的Webview2编写 可以尝试puppter undetected-chromedriver 990708 发表于 2023-10-9 11:16
undetected-chromedriver
那个没用,根本过不了检测
页:
[1]