Python PAM30 IE Operation Module example

Source: Internet
Author: User


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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.