sudangshou8192
sudangshou8192
2018-12-28 10:08

求教~python登录邮箱报错

  • python
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.126.com")

class Mail():

    def __init__(self,mail='',password=''):
        self.mail = mail
        self.password = password

    def login(user_info):
        iframe = driver.find_element_by_tag_name("iframe")
        driver.switch_to.frame(iframe)
        driver.find_element_by_name("email").send_keys(user_info.mail)
        driver.find_element_by_name("password").send_keys(user_info.password)
        driver.find_element_by_id("dologin").click()

    def logout(user_info):
        driver.find_element_by_id("_mail_component_35_35").click()
        driver.close()

admin = Mail(mail='123456',password='123456')
Mail.login(admin)

图片说明
图片说明

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答