PAMIE,Python控制IE的双节棍
来源:互联网 发布:同花顺贵金属交易软件 编辑:程序博客网 时间:2024/04/30 10:01
# -*- coding: gb2312 -*-
from PAM30 import PAMIE
from string import split
#===============================================================================
# 从文件读取配置信息,登录url,账户,密码等
#===============================================================================
def getCfgFromFile(fileName='settings.txt'):
file = open(fileName)
dict = {}
line = file.readline()
while line != '':
args = split(line, '=')
dict[args[0]] = args[1].decode('utf-8').encode('gb2312')
line = file.readline()
return dict
dict = getCfgFromFile()
ie = PAMIE()
#===============================================================================
# 打开登录页面,设置用户/密码
#===============================================================================
ie.navigate(dict['login-url'])
ie.setTextBox('username', dict['username'])
ie.setTextBox('password', dict['password'])
#===============================================================================
# 获取登录按钮
#===============================================================================
loginbtn = ie.findElement('input', 'type', 'image')
ie.clickElement(loginbtn)
#===============================================================================
# 点击文章管理
#===============================================================================
ie.navigate(dict["article-url"])
#===============================================================================
# 点击写文章
#===============================================================================
mainFrame = ie.getFrame('main')
pwindow = mainFrame.document.parentWindow
pwindow.execScript('NewArticle()')
#===============================================================================
# 设置文章标题,文章分类,系统分类,文章类型
#===============================================================================
mainFrame = ie.getFrame('main')
doc = mainFrame.document
#------------------------------------------------------------------------ 设置文章标题
doc.getElementById('blog_title').value = dict['title']
#------------------------------------------------------------------------ 文章分类-java
doc.getElementById('frmid').value = '119124'
#------------------------------------------------------------------------ 系统分类-java
doc.getElementById('systemfrmid').value = '20'
#----------------------------------------------------------------------- 文章类型-原创
doc.getElementById('arttype').value = dict['arttype']
#===============================================================================
# 填写文章内容
#===============================================================================
pwindow = mainFrame.document.parentWindow
pwindow.execScript('InsertHTML("Python+PAMIE")')
pwindow.execScript('InsertHTML("如此强大的功能")')
#===============================================================================
# 发表文章
#===============================================================================
pwindow.execScript('savearticle()')
- PAMIE,Python控制IE的双节棍
- PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- pamie,记住了,python模拟浏览器(ie)的模块
- Pamie模块详解 python操作ie浏览器
- Python PAMIE模块实现IE自动化
- Pamie模块详解 python操作ie浏览器
- python3下的IE自动化模块PAMIE
- python3下的IE自动化模块PAMIE
- PAMIE- Python实现IE自动化的模块(附 网易注册代码)
- python学习------Pamie模块
- Python PAMIE示例
- Modify the PAMIE for attach opened IE
- Python模块之PAMIE基本方法
- 使用Python控制IE访问网站
- ubuntu10.04下配置java
- PETSC ERROR: Segmentation Violation, probably memory access out of range
- JAVA 10个常最遇到的异常
- C语言程序设计大赛题目两道
- 这个网站上的东西挺多的
- PAMIE,Python控制IE的双节棍
- 用Delphi制作DLL
- linux变量及shell基础知识
- 2011.04.18的那一天
- 使用rcp自带console输出信息
- 展望
- Corba note
- [Java] Thread.setName() 设置线程名字
- java this 关键字