Before, I learned that there is a cross-platform, cross-language automated test tool selenium that can support multiple browsers. Today, I saw a simple version of Python's Test module PAM30 on the web. The tool is powerful and chicken-threatened. The strong point is that it supports almost all browser operations, and the chicken threat is to support only IE and Windows platforms. Here is a look at the features for a few small examples.
First, Login
Import PAM30
Ie=pam30. Pamie () #打开浏览器
Ie.navigate (' Http://www.111Cn.net/login ') #打开网址
Ie.settextbox (' username ', Unicode (' op-d ', ' utf-8 ') #输入用户名
Ie.settextbox (' Password ', ' My password doesn't tell you ') #输入密码
Ie.clickbutton (' Loginsubmit ') #点击登录按钮
Second, conduct web search
From PAM30 import Pamie
Ie=pamie ()
Ie.navigate (' www.baidu.com ') #在这里我们需要实现打开一个外国谷歌的主页
Ie.changewidnow (' www.111Cn.net ') #通过百度搜索本站运维之路
Ie.settextbox (' Q ', ' Pamie ')
Ie.clickbutton (' btng ')
Third, refresh the page
#! /usr/bin/env python
#coding =utf-8
Import Urllib.request
Import time
Import Random
From PAM30 import Pamie
ie = Pamie ()
Ie.navigate (' http://www.111Cn.net ')
Times=0
While times < 20:
Time.sleep (1)
"""
Time.sleep (Random.randint (3,5))
Ie.closewindow ()
Ie.navigate (' http://www.111Cn.net ')
"""
Ie.refresh ()
Times+=1
Print ("Refresh%d Times"%)
This module can carry out automatic start, access link, set text box value, Get button, perform click event, even execute page JS method and so on. More multi-functional waiting for you to discover.