最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python使用win32com在百度空間插入html元素示例

 更新時(shí)間:2014年02月20日 09:34:57   作者:  
這篇文章主要介紹了python使用win32com在百度空間插入html元素的示例,大家參考使用吧

復(fù)制代碼 代碼如下:

from win32com.client import DispatchEx
import time
ie=DispatchEx("InternetExplorer.Application")

ie.Navigate("http://hi.baidu.com/mirguest/creat/blog/")
ie.Visible=1
while ie.Busy:
    time.sleep(1)

body=ie.Document.body
# header
for i in body.getElementsByTagName("input"):
    if str(i.getAttribute("id"))=="spBlogTitle":
        print "Find title"
        i.value="AutoCreatedByPython"
        break

# editor
for i in body.getElementsByTagName("iframe"):
    print "Find iframe"
    if str(i.getAttribute("id"))=="tangram_editor_iframe_TANGRAM__1":
        print "Find"
        break
iframe=i
iframe.click()
sondoc=iframe.contentWindow.Document;
print sondoc
sonbody=sondoc.body
print sonbody
for ii in sonbody.getElementsByTagName("p"):
    print "Find p"
    ii.innerHTML="hello,my first try"
tmp=sondoc.createElement("div")
tmp.innerHTML="bye"
sonbody.insertBefore(tmp,ii)

tmpHTML="<div>hello 2</div>"
sonbody.insertAdjacentHTML("beforeEnd",tmpHTML)
'''
editor.getContentHTML
'''

# submit
for i in body.getElementsByTagName("div"):
    if str(i.getAttribute("id"))=="btn-box":
        print "Find button"
        break

btnbox=i
j=btnbox.childNodes(0)
j.click()

相關(guān)文章

  • Python中的模塊和包概念介紹

    Python中的模塊和包概念介紹

    這篇文章主要介紹了Python中的模塊和包概念介紹,本文講解了模塊概述、模塊名稱空間、導(dǎo)入模塊、導(dǎo)入模塊屬性(from … import …)、包等內(nèi)容,需要的朋友可以參考下
    2015-04-04
  • python用win32gui遍歷窗口并設(shè)置窗口位置的方法

    python用win32gui遍歷窗口并設(shè)置窗口位置的方法

    今天小編就為大家分享一篇python用win32gui遍歷窗口并設(shè)置窗口位置的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-07-07
  • Django實(shí)現(xiàn)一對(duì)多表模型的跨表查詢方法

    Django實(shí)現(xiàn)一對(duì)多表模型的跨表查詢方法

    今天小編就為大家分享一篇Django實(shí)現(xiàn)一對(duì)多表模型的跨表查詢方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-12-12
  • python監(jiān)控網(wǎng)卡流量并使用graphite繪圖的示例

    python監(jiān)控網(wǎng)卡流量并使用graphite繪圖的示例

    這篇文章主要介紹了python監(jiān)控網(wǎng)卡流量并使用graphite繪圖的示例,需要的朋友可以參考下
    2014-04-04
  • 最新評(píng)論

    栾川县| 绍兴县| 洞口县| 敖汉旗| 中宁县| 瑞金市| 临海市| 唐山市| 茂名市| 上犹县| 通渭县| 哈尔滨市| 武平县| 哈尔滨市| 丹寨县| 岳阳县| 犍为县| 平乡县| 临清市| 济源市| 西宁市| 静海县| 乌兰浩特市| 西丰县| 中牟县| 诸暨市| 余江县| 如东县| 横峰县| 宣汉县| 五家渠市| 古丈县| 天台县| 松阳县| 涿州市| 花莲县| 宜章县| 慈溪市| 河北省| 新宁县| 卢龙县|