flyps 发表于 2023-2-20 00:10:29

selenium登陆拼多多后台总需要验证

from selenium import webdriver

url = 'https://mms.pinduoduo.com/login'
driver = webdriver.Chrome(r"chromedriver.exe")
driver.maximize_window()
driver.get(url)



为什么selenium登陆拼多多后台,每次都需要验证,请问如何避免,谢谢!

isdkz 发表于 2023-2-20 00:10:30

主要思路是要绕过网站对浏览器驱动的检测,我给你找了网上的一个方法,亲测有效

参考链接:http://events.jianshu.io/p/965e29499dcb
from selenium import webdriver

with open('stealth.min.js') as f:
    js = f.read()

url = 'https://mms.pinduoduo.com/login'
driver = webdriver.Chrome(r"chromedriver.exe")
driver.maximize_window()
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source": js
})
driver.get(url)
input()

页: [1]
查看完整版本: selenium登陆拼多多后台总需要验证