def test_login(self): self.dr.login(self.dr.getDriver(), self.url) self.driver.implicitly_wait(30) print u"校验是否登录成功" '''判断是否存在已编辑按钮''' if BaseFunction.getLocator(self.driver, "page_button").is_enabled(): print u"登录成功" else: print u"登录失败"
def test_Kill_sku(self): self.driver.implicitly_wait(30) BaseFunction.getLocator(self.driver, "page_button").click()
def test_asles_management(self): self.driver.implicitly_wait(30) #销售管理模块 BaseFunction.getLocator(self.driver, "sales_button").click()
#coding=utf-8 import sys import os curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath) from TestScript import TestSuite from public import BaseFunction, SendEmail '''测试入口''' if __name__ == "__main__": # 运行所有case BaseFunction.Report().run(TestSuite.createsuite()) SendEmail.SendReport_Email() #发送邮件
def test_cash_coupon(self): self.driver.implicitly_wait(30) BaseFunction.getLocator(self.driver, "coupon_button").click() BaseFunction.getLocator(self.driver, "batch_coupon_button").click() BaseFunction.getLocator(self.driver, "batch_add_button").click() BaseFunction.getLocator(self.driver, "coupon_type_button").click() BaseFunction.getLocator(self.driver, "coupon_name_text").send_keys(u"测试批量发券") #时间控件的处理 BaseFunction.getLocator(self.driver, "coupon_value_text").send_keys( self.coupon_price) BaseFunction.getLocator(self.driver, "coupon_time_type").click() BaseFunction.getLocator(self.driver, "expired_after_text").send_keys(2) BaseFunction.getLocator(self.driver, "coupon_total_text").click() BaseFunction.getLocator(self.driver, "coupon_total_text").send_keys(1) BaseFunction.getLocator(self.driver, "save_button").click() self.driver.switch_to_alert().accept() time.sleep(3) now_handle = self.driver.current_window_handle #获取当前窗口句柄 BaseFunction.getLocator(self.driver, "view_button").click() time.sleep(3) all_handles = self.driver.window_handles #获取所有窗口句柄 for handle in all_handles: if handle != now_handle: self.driver.switch_to_window(handle) js = "var q=document.documentElement.scrollTop=5000" self.driver.execute_script(js) BaseFunction.getLocator(self.driver, "Nodown_button").click() BaseFunction.getLocator(self.driver, "down_button").click() BaseFunction.getLocator(self.driver, "phone_text").send_keys(self.phone) BaseFunction.getLocator(self.driver, "query_button").click() BaseFunction.getLocator(self.driver, "query_button_1").click() break