• 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数组的处理代码
  • Python脚本实现格式化css文件
  • Ubuntu下python版本管理
  • python分析apache访问日志脚本分享
  • Python selenium 三种等待方式解读
  • python实现二维码扫码自动登录淘宝
  • 用Python写一个无界面的2048小游戏
  • Python彩色化Linux的命令行终端界面的代码实例分享
  • Python中的异常处理相关语句基础学习笔记
  • 简单学习Python time模块

文章分类

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

最近更新的内容

    • 使用Python脚本在Linux下实现部分Bash Shell的教程
    • Python THREADING模块中的JOIN()方法深入理解
    • Python3字符串学习教程
    • 用Python脚本来删除指定容量以上的文件的教程
    • Python help()函数用法详解
    • 使用PDB简单调试Python程序简明指南
    • python 打印对象的所有属性值的方法
    • 在Python的Django框架中用流响应生成CSV文件的教程
    • Python中pip安装非PyPI官网第三方库的方法
    • Python中使用Inotify监控文件实例

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

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