from selenium import webdriver import time class Q_mail(object): def __init__(self, name, passward): self.start = "https://mail.qq.com/" self.name = name self.passward = passward self.driver = webdriver.Chrome() def run(self): self.driver.get(url=self.start) self.driver.switch_to_frame("login_frame") self.driver.find_element_by_id("u").send_keys(self.name) self.driver.find_element_by_id("p").send_keys(self.passward) self.driver.find_element_by_id("login_button").click() time.sleep(10) # print(self.driver.page_source) print(self.driver.get_cookies()) def __del__(self): self.driver.quit() if __name__ == '__main__': denglu = Q_mail(name=input("请输入qq邮箱:"), passward=input("请输入密码:")) denglu.run()