def main(): try: driver = Pyse("chrome") username = '******' password = '******' test_user_login(driver, username, password) sleep(3) text = driver.get_text("//span[@id='spnUid']") assert(text == '*****@*****.**'),u"用户名称不匹配,登录失败!" finally: # 关闭浏览器窗口 driver.close()
def main(): try: driver = Pyse("chrome") username = '******' password = '******' test_user_login(driver, username, password) sleep(3) text = driver.get_text("//span[@id='spnUid']") assert (text == '*****@*****.**'), u"用户名称不匹配,登录失败!" finally: # 关闭浏览器窗口 driver.close()
class testwarehouseinner(unittest.TestCase): def setUp(self): self.driver = Pyse('chrome') self.driver.open( 'http://t4567.xyscm-biz-warehouse-web.yunzong:12370/#/login') self.driver.max_window() self.driver.type('class=>userName', 'yxadmin1') time.sleep(1) self.driver.type('class=>password', 'y123456') time.sleep(1) self.driver.click('class=>button') def tearDown(self): self.driver.close() def test1(self): self.driver.click( 'xpath=>/html/body/div/div[2]/div[1]/div/div/ul/li[4]/div/span') time.sleep(1) self.driver.click( 'xpath=>/html/body/div/div[2]/div[1]/div/div/ul/li[4]/ul/li[3]/span' ) time.sleep(1) self.driver.click( 'xpath=>//*[@id="content"]/div[2]/div[1]/button/span') #点击新增 time.sleep(1) self.driver.click( 'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[1]/div/div/div/span/span/i' ) #点击下拉框 time.sleep(1) self.driver.click( 'xpath=>/html/body/div[3]/div[1]/div[1]/ul/li[2]/span') time.sleep(1) self.driver.type( 'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[2]/div/div[1]/input', 'test1') time.sleep(1) self.driver.type( 'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[3]/div/div[1]/input', 'test001') time.sleep(1) self.driver.click( 'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[4]/div/div/div/input' ) time.sleep(1) self.driver.click( 'xpath=>/html/body/div[4]/div[1]/div[1]/ul/li[1]/span') time.sleep(1) self.driver.click( 'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[5]/div/button' ) time.sleep(4)
class uiRecover(unittest.TestCase): def setUp(self): self.driver = Pyse('chrome') self.driver.open( 'http://t5609.xyscm-biz-manager-web.yunzong:12050/#/login') self.driver.max_window() self.driver.type('class=>userName', 'yangxuegx') time.sleep(0.5) self.driver.type('class=>password', 'y123456') time.sleep(0.5) self.driver.click('class=>button') time.sleep(1) def tearDown(self): self.driver.close() def test_add_customer(self): self.driver.click( 'xpath=>/html/body/div/div[2]/div[1]/div/div/ul/li[7]/div/span' ) #点击客户管理,弹出下拉框 time.sleep(0.5) self.driver.ciick( 'xpath=>/html/body/div/div[2]/div[1]/div/div/ul/li[7]/ul/li[1]/span' ) #点击客户列表 time.sleep(0.5) self.driver.click( 'xpath=>//*[@id="content"]/div[2]/div[2]/button/span') #点击新增客户 time.sleep(0.5) self.driver.type( 'xpath=>//*[@id="content"]/div[2]/form/div[1]/div[1]/div[1]/div/div/div/input', '自动测试客户一') #输入客客户名称 time.sleep(0.5) self.driver.type( 'xpath=>//*[@id="content"]/div[2]/form/div[1]/div[1]/div[2]/div/div/div/input', '自动执行业务员一') #输入业务员名称 time.sleep(0.5)