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

            色偷偷888欧美精品久久久| 久久夜色精品国产欧美乱| 久久强奷乱码老熟女网站| 亚洲va久久久久| 久久精品国产亚洲AV大全| 色综合久久中文综合网| 伊人色综合久久天天网| 91久久福利国产成人精品| 亚洲精品无码久久千人斩| 亚洲人成无码网站久久99热国产| 欧美久久久久久| 狠狠精品久久久无码中文字幕 | 久久亚洲精品无码观看不卡| 亚洲AV日韩精品久久久久久| 91精品国产色综久久| 2021国内久久精品| 国产免费久久精品99re丫y| 久久久久免费精品国产| 欧美亚洲色综久久精品国产| 亚洲人成电影网站久久| 国产成人99久久亚洲综合精品| 国产精品久久久99| 久久精品亚洲日本波多野结衣 | 青青草原综合久久大伊人| 久久综合九色综合久99| jizzjizz国产精品久久| 久久国产精品99精品国产| 99精品国产免费久久久久久下载 | 伊人伊成久久人综合网777| 国产精品综合久久第一页| 国产精品久久自在自线观看| 久久久久国产精品| 999久久久免费精品国产| 久久精品天天中文字幕人妻| 久久中文骚妇内射| 久久精品九九亚洲精品| 久久中文骚妇内射| 久久久精品午夜免费不卡| 91精品免费久久久久久久久| 国产精品伊人久久伊人电影| 久久人人爽人人爽AV片|