selenium测试一

#!/usr/bin/python

# -*- coding: UTF-8 -*-
# author zhangchao 2015-06-20
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from Tkconstants import BROWSE
from selenium.webdriver.common.action_chains import ActionChains
import time
import sys
import selenium
import re
from selenium.selenium import selenium
reload(sys)

sys.setdefaultencoding('utf-8')

piaojuke.find_element_by_id("login_account").send_keys(loginname)
piaojuke.find_element_by_xpath("//input[@id='login_password']").send_keys(password)

xuanting=ActionChains(piaojuke)
a=piaojuke.find_element_by_xpath("//li[@class='uname']")
xuanting.move_to_element(a).perform()
time.sleep(5)
piaojuke.find_element_by_xpath("//li[@class='umess hidden']").click()

piaojuke.find_element_by_link_text("银票宝").click()

true_order=piaojuke.find_element_by_class_name("number").text

url=piaojuke.current_url
order=re.compile("RG_[0-9]{16}")###使用正规则获取订单号,

######[0-9]{16}连续匹配16位数字
bill_order=order.search(url).group()
return bill_order

 #################这个是测selenium测试的源码,这个是用于python编写#########################

posted on 2015-06-21 22:22  小炒  阅读(153)  评论(0编辑  收藏  举报

导航