基于selenium的twitter博文评论爬虫
技术合作联系:13958075150 【1】首次登录获取cookies并存为文件 from selenium import webdriver import time import json br = webdriver.Chrome() br.get("https://twitter.com/login?prefetchTimestamp=1574961630352") # 填写手机号 user_name = br.find_element_by_css_selector('#page-container > div > div.signin-wrapper > form > fieldset > div:nth-child(2) > input') user_name.send_keys('您的账号') # 填写密码 password_input = br.find_element_by_xpath('//*[@id="page-container"]/div/div[1]/form/fieldset/div[2]/input') password_input.send_keys('您的密码') # 登陆 br.find_element_by_xpath('//*[@id="page-container"]/div/div[1]/form/div[2]/button')