python+selenium自动登陆UI自动化实例
python+selenium自动登陆UI自动化实例刚入门写了一个简单的登陆,希望能和大家相互交流
#!/usr/bin/env python
#_*_coding:utf-8_*_
import time
def login1(username,password):
from selenium import webdriver
driver=webdriver.Firefox()
url='http://hxtest.51tv.com/aibb'
driver.get(url)
time.sleep(2)
driver.maximize_window()
time.sleep(2)
driver.find_element_by_partial_link_text('登录').click()
time.sleep(2)
#driver.set_window_size(540,960)
driver.find_element_by_id('zhanghao').send_keys(username)
time.sleep(1)
driver.find_element_by_id('password').send_keys(password)
time.sleep(2)
driver.find_element_by_class_name('btns').click()
time.sleep(2)
#driver.close()
driver.quit()
login={'test02':'123456',
'test03':'123456'
}
for username,password in login.items():
login1(username,password)
支持分享 我刚开始学习 testing_001 支持下! :handshake支持分享 123 :lol
页:
[1]