python3 selenium 自动化测试

python3 selenium 自动化测试


# -*- coding: utf-8 -*-
__author__ = 'dxw'
__date__ = '2016-2-29'

from selenium import webdriver

class xxxpayTest(object):
    """
    xxxpayTest
    """
    url = 'http://www.xxxpay.com/test/pay.jsp'
 
    def __init__(self, productprice):
        self.driver = webdriver.Firefox()
        #self.driver = webdriver.Ie()
        self.productprice = productprice

    def do_test(self):
        self.driver.get(self.url)
        productprice_elem = self.driver.find_element_by_id("productprice")
        productprice_elem.clear()
        productprice_elem.send_keys(self.productprice)
        
        submit_elem = self.driver.find_element_by_xpath("/html/body/center/form") 

        submit_elem.submit()
 
 
if __name__ == '__main__':
    productprice = '98'
    xx = xxxpayTest(productprice)
    xx.do_test()






你可能感兴趣的:(python3 selenium 自动化测试)