• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > python使用win32com在百度空间插入html元素示例

python使用win32com在百度空间插入html元素示例

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了win32com python,python win32com下载,python win32com安装,win32com python3,win32com.client等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

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

</div>

您可能想查找下面的文章:

  • python使用win32com库播放mp3文件的方法
  • 用python登录Dr.com思路以及代码分享
  • python使用win32com在百度空间插入html元素示例
  • python使用win32com在百度空间插入html元素示例

相关文章

  • python使用PIL模块实现给图片打水印的方法
  • 用Python编写简单的微博爬虫
  • 详解Python中映射类型的内建函数和工厂函数
  • 用smtplib和email封装python发送邮件模块类分享
  • Python检测字符串中是否包含某字符集合中的字符
  • 优化Python代码使其加快作用域内的查找
  • 使用Python进行新浪微博的mid和url互相转换实例(10进制和62进制互算)
  • python使用正则搜索字符串或文件中的浮点数代码实例
  • python代码制作configure文件示例
  • python 打印对象的所有属性值的方法

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • python制作花瓣网美女图片爬虫
    • 在Python中通过threading模块定义和调用线程的方法
    • Python发送form-data请求及拼接form-data内容的方法
    • Python数据类型详解(三)元祖:tuple
    • python爬取w3shcool的JQuery课程并且保存到本地
    • Python使用sftp实现上传和下载功能(实例代码)
    • Python中的并发编程实例
    • 使用Python编写一个模仿CPU工作的程序
    • python基础教程之基本数据类型和变量声明介绍
    • 简单谈谈Python中的几种常见的数据类型

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有