Selenium之自动发送163邮件.py
版一: import timeimport datetimefrom selenium import webdriverfrom selenium.webdriver.support.wait import WebDriverWait # 等待页面加载某些元素from selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.common.by import Byfrom getpass import getpassdef login(user, pwd): """ 登录163邮箱 """ # 由于可以扫码登录,而我们选择用户名和密码登录,所以,要点击 密码登录 time.sleep(1) wait.until(EC.presence_of_element_located((By.ID, 'switchAccountLogin'))).click() # 进入iframe,因为有多个iframe,所以获取的是数组,在分析页面后,数组0索引的iframe是登陆的iframe time.sleep(3) iframe = driver.find_elements_by_tag_name('iframe') # print(iframe) ''' [ <selenium