from selenium import webdriver
import time
driver = webdriver.Chrome()
#打开网址
driver.get("https://accounts.douban.com/passport/login")
#点击账号登录
driver.find_element_by_class_name("account-tab-account").click()
#输入账号密码
driver.find_element_by_id("username").send_keys("账号")
driver.find_element_by_id("password").send_keys("密码")
#点击登录
driver.find_element_by_link_text('登录豆瓣').click()
#睡5秒钟
time.sleep(5)
#获取网页的源代码
#个人信息
#https://www.douban.com/note/773485266/
#个人设置
#https://accounts.douban.com/passport/setting
#进入要访问的页面
driver.get("https://accounts.douban.com/passport/setting")
#拿到这个页面的源码
html = driver.page_source
#打印最终的源码
print(html)
time.sleep(5)
#关闭
driver.quit() #自动关闭