• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 41, 文章 - 8, 評論 - 8, 引用 - 0
            數據加載中……

            [導入][python]關于在百度空間中插入html元素

            哈哈,剛才又試了試,發現可以直接創建html元素,然后插進去就可以了。

            代碼和剛才差不多,就是多了個插入的操作:

            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()

             

            閱讀全文
            類別:默認分類 查看評論
            文章來源:http://hi.baidu.com/mirguest/blog/item/a92687925f53fa9ea977a4ea.html

            posted on 2011-02-07 12:22 mirguest 閱讀(178) 評論(0)  編輯 收藏 引用

            7国产欧美日韩综合天堂中文久久久久| 久久国产精品一区| 久久久久久国产精品免费无码 | 亚洲国产成人精品91久久久| 波多野结衣久久一区二区| 亚洲色大成网站www久久九| 2021精品国产综合久久| 中文字幕久久欲求不满| 一本久久a久久精品综合香蕉| 久久亚洲精品人成综合网| 99久久久久| 久久久久久亚洲精品成人| 久久久无码精品亚洲日韩软件| 久久SE精品一区二区| 国产成人精品久久综合| 亚洲国产精品久久电影欧美| 久久久亚洲精品蜜桃臀| 国产一区二区精品久久| 一本色道久久88精品综合| 久久99精品久久久久久秒播| 亚洲国产精品无码久久久秋霞2 | 青春久久| 国产精品无码久久四虎| 精品熟女少妇av免费久久| 大香伊人久久精品一区二区| 精品熟女少妇aⅴ免费久久| 国内精品久久久久久99| 久久伊人五月丁香狠狠色| 国产精品美女久久久久AV福利| 久久精品天天中文字幕人妻| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 欧美午夜精品久久久久久浪潮| 国产精品欧美久久久天天影视| 中文字幕无码精品亚洲资源网久久| 亚洲国产成人久久综合一区77| 久久久久国产精品麻豆AR影院| 一本久久a久久精品综合夜夜| 欧美综合天天夜夜久久| 久久精品一区二区国产| 99久久免费国产精精品| 久久国产高潮流白浆免费观看|