Python automation 总结

web:

Python web automation  网页自动化技术

看看我自己写的程序,在web automation这个方面的数量最多。网上对这方面程序的需求也很多,因为web的时代,操作的工作量移到web上来了, 机器替代人的需求增大也就不足为奇。

无疑python是做这方面工作的好手:

总结一下python做web automation常用手段:

基于urllib2、urllib: 绝大多数都是这一类,如mechanize,twill,等等。基础模块都是urllib2,也就是wrapper。这类的是基于http请求响应的封装。我自己也写了一个叫autoform,调用文件模板填表,原理都一样。GOOGLE 每天都要在他的

内嵌webbrowser:如pyqt的webkit、PAMIE、spynner(基于webkit),这一类是我正准备研究的,因为urllib2处理有局限性,即不能处理动态的脚本如js,一些操作无法实现。这种内嵌的方式类似于com调用,所以支持所有浏览器操作,兼容性更好,但不如urllib快捷。

spynner:   https://github.com/kiorky/spynner/

 
  
1 A basic example:
2
3   import spynner
4 browser = spynner.Browser()
5 browser.load( " http://www.wordreference.com " )
6 browser.runjs( " console.log('I can run Javascript') " )
7 browser.runjs( " console.log('I can run jQuery: ' + jQuery('a:first').attr('href')) " )
8 browser.select( " #esen " )
9 browser.wk_fill( " input[name=enit] " , " hola " )
10 browser.click( " input[name=b] " )
11 browser.wait_page_load()
12 print browser.url, browser.html
13 browser.close()
14
15 # Sometimes you'll want to see what is going on:
16
17 browser = spynner.Browser()
18 browser.debug_level = spynner.DEBUG
19 browser.create_webview()
20 browser.show()

 web test framwork :如selenium,我也没研究过。他的机制应该综合了以上两种方式,selenium IDE还可以生成代码,是一个强大的web测试工具。

ps:

Google 每天会在TESTING FARM上跑几万个SELENIUM测试CASE,现在也些会更多,你如果想学习SELENIUM, 可以从这里开始 http://selenium.seleniumhq.org/

 1261461490.png

 

Windows:

大多基于win32模块:

pywinauto http://pywinauto.googlecode.com/hg/pywinauto/docs/index.html

Watsup (http://www.tizmoi.net/watsup/intro.html)

winGuiAuto (http://www.brunningonline.net/simon/blog/archives/winGuiAuto.py.html)

Excel处理: xlrd, xlwt

转载于:https://www.cnblogs.com/babykick/archive/2011/05/27/2059955.html

Hands-On Enterprise Automation with Python: Automate common administrative and security tasks with the most popular language Python Invent your own Python scripts to automate your infrastructure Hands-On Enterprise Automation with Python starts by covering the set up of a Python environment to perform automation tasks, as well as the modules, libraries, and tools you will be using. We’ll explore examples of network automation tasks using simple Python programs and Ansible. Next, we will walk you through automating administration tasks with Python Fabric, where you will learn to perform server configuration and administration, along with system administration tasks such as user management, database management, and process management. As you progress through this book, you’ll automate several testing services with Python scripts and perform automation tasks on virtual machines and cloud infrastructure with Python. In the concluding chapters, you will cover Python-based offensive security tools and learn how to automate your security tasks. By the end of this book, you will have mastered the skills of automating several system administration tasks with Python. What You Will Learn Understand common automation modules used in Python Develop Python scripts to manage network devices Automate common Linux administration tasks with Ansible and Fabric Managing Linux processes Administrate VMware, OpenStack, and AWS instances with Python Security automation and sharing code on GitHub
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值