python 模擬登陸163郵箱
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
def login():
acount_num = input('請輸入賬號:\n')
passwd_str = input('請輸入密碼:\n')
driver = webdriver.Edge()
url = 'http://mail.163.com/'
driver.get(url)
# 等待頁面加載完成,出現(xiàn)可以點(diǎn)擊到密碼登錄的button
wait = WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((By.ID, 'lbNormal')))
driver.find_element_by_id('lbNormal').click()
# 使用CSSSelector正則匹配頭部
elem = driver.find_element_by_css_selector("iframe[id^='x-URS-iframe']")
# 163登陸框是使用iframe進(jìn)行嵌套的,所以需要先切換到該iframe
driver.switch_to.frame(elem)
account_el = driver.find_element_by_xpath('//input[@name="email"]')
account_el.clear()
account_el.send_keys(acount_num)
password_el = driver.find_element_by_xpath('//input[@name="password"]')
password_el.clear()
password_el.send_keys(passwd_str)
login_el = driver.find_element_by_xpath('//a[@id="dologin"]')
login_el.click()
time.sleep(10)
cur_cookies = driver.get_cookies()
return cur_cookies
if __name__ == '__main__':
login()
以上就是python 模擬登陸163郵箱的詳細(xì)內(nèi)容,更多關(guān)于python 模擬登陸的資料請關(guān)注腳本之家其它相關(guān)文章!
- python 實(shí)現(xiàn)網(wǎng)易郵箱郵件閱讀和刪除的輔助小腳本
- python實(shí)現(xiàn)定時(shí)發(fā)送郵件到指定郵箱
- Python 使用office365郵箱的示例
- Python爬蟲如何應(yīng)對Cloudflare郵箱加密
- python使用QQ郵箱實(shí)現(xiàn)自動發(fā)送郵件
- python實(shí)現(xiàn)126郵箱發(fā)送郵件
- python3通過qq郵箱發(fā)送郵件以及附件
- 用python打開攝像頭并把圖像傳回qq郵箱(Pyinstaller打包)
- 使用python自動追蹤你的快遞(物流推送郵箱)
- Python使用QQ郵箱發(fā)送郵件報(bào)錯smtplib.SMTPAuthenticationError
- python實(shí)現(xiàn)web郵箱掃描的示例(附源碼)
相關(guān)文章
在Lighttpd服務(wù)器中運(yùn)行Django應(yīng)用的方法
這篇文章主要介紹了在Lighttpd服務(wù)器中運(yùn)行Django應(yīng)用的方法,本文所采用的是最流行的FastCGI模塊,包括同時(shí)運(yùn)行多個Django應(yīng)用的方法,需要的朋友可以參考下2015-07-07
Python 網(wǎng)頁解析HTMLParse的實(shí)例詳解
這篇文章主要介紹了Python 網(wǎng)頁解析HTMLParse的實(shí)例詳解的相關(guān)資料,python里提供了一個簡單的解析模塊HTMLParser類,使用起來也是比較簡單的,解析語法沒有用到XPath類似的簡潔模式,需要的朋友可以參考下2017-08-08
Python 轉(zhuǎn)換數(shù)據(jù)類型函數(shù)和轉(zhuǎn)換數(shù)據(jù)類型的作用
這篇文章主要介紹了Python 轉(zhuǎn)換數(shù)據(jù)類型函數(shù)和轉(zhuǎn)換數(shù)據(jù)類型的作用,圍繞Python 轉(zhuǎn)換數(shù)據(jù)類型的相關(guān)資料展開內(nèi)容,具有一定的參考價(jià)值,需要的小伙伴可以參考一下2022-03-03
python中itertools模塊zip_longest函數(shù)詳解
itertools模塊包含創(chuàng)建高效迭代器的函數(shù),這些函數(shù)的返回值不是list,而是iterator(可迭代對象),可以用各種方式對數(shù)據(jù)執(zhí)行循環(huán)操作,今天我們來詳細(xì)探討下zip_longest函數(shù)2018-06-06
Python基于Google?Bard實(shí)現(xiàn)交互式聊天機(jī)器人
這篇文章主要為大家介紹了Python基于Google?Bard實(shí)現(xiàn)交互式聊天機(jī)器人示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-03-03
Django ORM 聚合查詢和分組查詢實(shí)現(xiàn)詳解
這篇文章主要介紹了Django ORM 聚合查詢和分組查詢實(shí)現(xiàn)詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-08-08
深入學(xué)習(xí)Python中的上下文管理器與else塊
這篇文章主要給大家介紹了關(guān)于Python中上下文管理器與else塊的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。2017-08-08

