濠江岁月上,汽车站标志,苍井空开b图片
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()
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python 实现将numpy中的nan和inf,nan替换成对应的均值
python爬虫把url链接编码成gbk2312格式过程解析
网友评论