新公司这边客服流动频繁,为防止密码泄露,写了个小脚本.可以让用户在不知道密码的情况下自动登录淘宝
主要代码:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#!/usr/bin/python2.5
# -*- coding: utf-8 -*-
'''
Created on 2011-5-28
@author: fred <me@fengsage.com>
'''
'''
自动登录淘宝脚本
'''
def login_taobao(username, password):
from apps.PAM30 import PAMIE
ie = PAMIE()
ie.navigate("https://login.taobao.com/member/login.jhtml")
tmp_element = ie.findElement('input','name','loginType')
if tmp_element.getAttribute("value")=="4":
checkBox = ie.findElement('input', 'id', 'J_SafeLoginCheck')
ie.clickElement(checkBox)
if ie.textBoxExists('TPL_username') and ie.textBoxExists('TPL_password'):
ie.setTextBox('TPL_username', username)
ie.setTextBox('TPL_password', password)
loginbtn = ie.findElement('button', 'type', 'submit')
ie.clickElement(loginbtn) |
使用PAMIE,可以轻松控制IE做任何操作~~
I love Python~
近期评论