• <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 閱讀(184) 評論(0)  編輯 收藏 引用

            一级女性全黄久久生活片免费| 久久综合色老色| 久久99精品综合国产首页| 色综合久久精品中文字幕首页| 久久九九有精品国产23百花影院| 93精91精品国产综合久久香蕉| 欧美久久天天综合香蕉伊| 男女久久久国产一区二区三区| 国产精品内射久久久久欢欢| 国内高清久久久久久| 日本一区精品久久久久影院| 精品久久久久久久国产潘金莲 | 精品久久久久久亚洲精品 | 777久久精品一区二区三区无码| 四虎影视久久久免费观看| 亚洲国产精品一区二区久久| 久久婷婷五月综合97色直播| 久久久久九国产精品| 久久亚洲精品视频| 国产日产久久高清欧美一区| 一本一本久久aa综合精品| 久久性精品| 久久精品国产亚洲AV不卡| 久久精品草草草| 国产人久久人人人人爽| 无码人妻久久一区二区三区免费丨 | 秋霞久久国产精品电影院| 久久久一本精品99久久精品88| 久久天天婷婷五月俺也去| 久久青青国产| 久久中文字幕视频、最近更新| 777久久精品一区二区三区无码 | 51久久夜色精品国产| 日本精品久久久久中文字幕8| 国产V综合V亚洲欧美久久| 日韩精品久久无码中文字幕| 色欲综合久久中文字幕网| 久久久国产精品亚洲一区| 91精品国产综合久久婷婷| 狠狠久久亚洲欧美专区| 久久精品国产72国产精福利|