登录部分楼主可以参考我的代码思路,手写轨迹,一个容易过的点,一般登陆都会在60s内完成。
[Python] 纯文本查看 复制代码 from selenium.webdriver import ActionChains
from selenium import webdriver
import time
start_time = time.time()
options = webdriver.ChromeOptions()
options.add_argument("log-level=3")
driver = webdriver.Chrome(options=options)
driver.get('https://pan.baidu.com')
time.sleep(2)
driver.find_element_by_xpath('//*[@id="TANGRAM__PSP_4__footerULoginBtn"]').click()
driver.find_element_by_xpath('//*[@id="TANGRAM__PSP_4__userName"]').send_keys('')
driver.find_element_by_xpath('//*[@id="TANGRAM__PSP_4__password"]').send_keys('')
driver.find_element_by_xpath('//*[@id="TANGRAM__PSP_4__submit"]').click()
time.sleep(1.5)
slid_ing = driver.find_element_by_class_name('vcode-spin-button')
while True:
ActionChains(driver).click_and_hold(on_element=slid_ing).perform()
time.sleep(0.2)
for track in [0,0,0,1,1,1,1,2,2,2,3,3,3,3,3,4,4,4,4]:
ActionChains(driver).move_by_offset(xoffset=track, yoffset=0).perform()
try:
ActionChains(driver).release(on_element=slid_ing).perform()
except:
break
time.sleep(1.5)
cookies = driver.get_cookies()
print(cookies)
end_time = time.time()
print(f'耗时:{int(end_time-start_time)}s')
driver.quit() |