from selenium import webdriver
from lxml import etree
import requests
diver=webdriver.Chrome()
url='http://www.douban.com'
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36'}
d=requests.get(url=url,headers=headers).text
# print(d.content)
x=etree.HTML(d)
response=x.xpath('//iframe/@src')[0]#.extract_first() [@frameborder="0"]
# print(response)
diver.get('https:'+ response)
diver.find_element_by_class_name('account-tab-account').click()
diver.find_element_by_class_name('account-form-remember').click()
selenium模拟登陆豆瓣
最新推荐文章于 2022-09-19 14:30:55 发布