• <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
            數(shù)據(jù)加載中……

            [導入][python]關(guān)于在百度空間中插入html元素

            哈哈,剛才又試了試,發(fā)現(xiàn)可以直接創(chuàng)建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)  編輯 收藏 引用

            久久国产精品久久国产精品| 精品国产VA久久久久久久冰 | 一本久久知道综合久久| 久久亚洲中文字幕精品一区| 色婷婷综合久久久中文字幕| 亚洲国产成人久久精品影视| 无码8090精品久久一区| 97久久综合精品久久久综合| 亚洲精品视频久久久| 久久国产精品成人影院| 人人妻久久人人澡人人爽人人精品 | 99久久综合狠狠综合久久| 囯产精品久久久久久久久蜜桃| 久久美女网站免费| 无遮挡粉嫩小泬久久久久久久| 久久午夜无码鲁丝片午夜精品| 婷婷五月深深久久精品| 亚洲国产精品综合久久一线| 72种姿势欧美久久久久大黄蕉| 精品国产日韩久久亚洲| 久久国产香蕉视频| 久久久91人妻无码精品蜜桃HD | 精品国产VA久久久久久久冰| 久久人人爽人人爽人人片av麻烦| 久久精品三级视频| 久久久国产精品网站| 国产精品久久久久aaaa| 久久精品国产清高在天天线| 伊人色综合久久天天人手人婷| 无码任你躁久久久久久老妇App| 久久久久久久综合日本| 久久青青草原精品国产软件| 99久久精品国产毛片| 久久久久久A亚洲欧洲AV冫| 久久久久亚洲AV成人网| 久久久噜噜噜久久中文字幕色伊伊| 99久久亚洲综合精品成人| 国产精品热久久无码av| 看全色黄大色大片免费久久久| 四虎亚洲国产成人久久精品| 亚洲精品久久久www|