def setUpClass(cls): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.driver.implicitly_wait(5) # 隐式等待 cls.url = test_url cls.username = username cls.password = "******" cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵易购收藏界面") # 声明PublicMethod类对象 cls.home_page = HomePage(cls.driver, cls.url, u"合纵易购收藏界面") # 声明homePage类对象 cls.cart_page = CartPage(cls.driver, cls.url, u"合纵易购收藏界面") # 声明cartPage类对象 cls.categories_page = CategoriesPage( cls.driver, cls.url, u"合纵易购收藏界面") # 声明categoriesPage类对象 cls.puyao_page = PuYaoPage(cls.driver, cls.url, u"合纵易购收藏界面") # 声明puyaoPage类对象 cls.settle_page = SettlePage(cls.driver, cls.url, u"合纵易购收藏界面") # 声明settlePage类对象 cls.goodsdetail_page = GoodsDetailPage( cls.driver, cls.url, u"合纵易购收藏界面") # 声明goodsDetailPage类对象 cls.collection_page = CollectionPage( cls.driver, cls.url, u"合纵易购收藏界面") # 声明collectionPage类对象 cls.zhongyao_page = ZhongYaoPage(cls.driver, cls.url, u"合纵易购收藏界面") # 声明ZhongYaoPage类对象 cls.public_page.get_url(cls.url) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 cls.public_page.login(cls.username, cls.password) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭
def setUpClass(cls): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.driver.implicitly_wait(5) # 隐式等待 cls.url = test_url cls.username = username cls.password = "******" cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵易购积分商城界面") # 声明PublicMethod类对象 cls.categories_page = CategoriesPage(cls.driver, cls.url, u"合纵易购积分商城界面") # 声明categories类对象 cls.home_page = HomePage(cls.driver, cls.url, u"合纵易购积分商城界面") cls.jfsc_page = JiFenShangChengPage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明jifenshangchengPage类对象 cls.jfscqd_page = JiFenShangCheng_qiandaoPage( cls.driver, cls.url, u"合纵易购积分商城界面" ) # 声明JiFenShangChennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnng_qiandaoPage类对象 cls.jfscgrzx_page = JiFenShangCheng_gerenzhongxinPage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明JiFenShangCheng_grzxPage类对象 cls.jfscddxq_page = JiFenShangCheng_ddxqPage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明JiFenShangCheng_ddxqPage类对象 cls.jfsclpc_page = JiFenShangCheng_lipinchePage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明JiFenShangCheng_lipinchePage类对象 cls.public_page.get_url(cls.url) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 cls.public_page.login(cls.username, cls.password) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭
def setUpClass(cls): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.url = test_url cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵药易购商品分类界面") # 声明publicMethod类对象 cls.categories_page = CategoriesPage( cls.driver, cls.url, u"合纵药易购结算界面") # 声明categoriesPage类对象 cls.home_page = HomePage(cls.driver, cls.url, u"合纵药易购结算界面") # 声明homepage类对象 cls.puyao_page = PuYaoPage(cls.driver, cls.url, u"合纵药易购结算界面") # 声明puyaopage类对象 cls.settle_page = SettlePage(cls.driver, cls.url, u"合纵药易购结算界面") # 声明settlepage类对象 cls.cart_page = CartPage(cls.driver, cls.url, u"合纵药易购结算界面") # 声明cartpage类对象 cls.order_page = OrderPage(cls.driver, cls.url, u"合纵药易购结算界面") # 声明orderpage类对象 cls.driver.implicitly_wait(5) cls.username = username cls.password = "******" cls.ddbz = "订单备注" cls.public_page.get_url(cls.url) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 cls.public_page.login(cls.username, cls.password) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭
def setUpClass(cls): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.driver.implicitly_wait(5) # 隐式等待 cls.url = test_login_url cls.username = username cls.password = "******" cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵易购登录界面") # 声明publicMethod类对象 cls.login_page = LoginPage(cls.driver, cls.url, u"合纵易购登录界面") # 声明LoginPage类对象 cls.public_page.get_url(cls.url) # 调用打开url
def setUpClass(cls): cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.driver.implicitly_wait(30) cls.url = home_url cls.username = "******" cls.password = "******" cls.ssnr = "感冒灵" cls.xiangsu1 = "window.scrollBy(0, 800)" cls.xiangsu2 = "window.scrollBy(0, 200)" cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵易购首页界面") # 声明publicMethod类对象 cls.home_page = HomePage(cls.driver, cls.url, u"合纵易购首页界面") # 声明LoginPage类对象 cls.goodsDetail_page = GoodsDetailPage(cls.driver, cls.url, "合纵易购首页界面") # 声明GoodsDetailPage类对象 cls.public_page.get_url(cls.url) cls.public_page.login(cls.username, cls.password)
def setUpClass(cls): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.driver.implicitly_wait(5) # 隐式等待 cls.url = test_url cls.username = username cls.password = "******" # 声明categoriesPage类对象 cls.categories_page = CategoriesPage(cls.driver,cls.url, u"合纵药易购商品分类界面") # 声明publicMethod类对象 cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵药易购商品分类界面") cls.public_page.get_url(cls.url) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 cls.public_page.login(cls.username, cls.password) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭
def setUp(self): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" self.driver = webdriver.Chrome(executable_path=chromedriver) self.driver.implicitly_wait(30) self.url1 = login_url self.url2 = tejia_url self.username1 = "测试05" # 非区域会员 self.username2 = "测试06" # 非终端会员 self.username3 = "测试07" # 正常会员 self.password = "******" # 密码 self.public_page = PublicMethod(self.driver, self.url, u"合纵易购特价界面") # 声明publicMethod类对象 self.login_page = LoginPage(self.driver, self.url, u"合纵易购特价界面") # 声明LoginPage类对象 self.tejia_page = TeJiaPage(self.driver, self.url, u"合纵易购特价界面") # 声明TeJiaPage类对象 self.goodDetail_page = GoodsDetailPage( self.driver, self.url, u"合纵易购特价界面") # 声明GoodsDetailPage self.cart_page = CartPage(self.driver, self.url, u"合纵易购特价界面") # 声明cartPage self.home_page = HomePage(self.driver, self.url, u"合纵易购特价界面") # 声明homePage self.settle_page = SettlePage(self.driver, self.url, u"合纵易购特价界面") # 声明settlePage
def setUp(self): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" self.driver = webdriver.Chrome(executable_path=chromedriver) self.url = test_url self.public_page = PublicMethod(self.driver, self.url, u"合纵药易购订单界面") # 声明publicMethod类对象 self.categories_page = CategoriesPage( self.driver, self.url, u"合纵药易购订单界面") # 声明categoriesPage类对象 self.home_page = HomePage(self.driver, self.url, u"合纵药易购订单界面") # 声明homepage类对象 self.puyao_page = PuYaoPage(self.driver, self.url, u"合纵药易购订单界面") # 声明puyaopage类对象 self.jpzq_page = JingPinZhuanQuPage( self.driver, self.url, u"合纵药易购订单界面") # 声明jingpinzhuanqu类对象 self.settle_page = SettlePage(self.driver, self.url, u"合纵药易购订单界面") # 声明settlepage类对象 self.cart_page = CartPage(self.driver, self.url, u"合纵药易购订单界面") # 声明cartpage类对象 self.order_page = OrderPage(self.driver, self.url, u"合纵药易购订单界面") # 声明orderpage类对象 self.zhongyao_page = ZhongYaoPage(self.driver, self.url, u"合纵药易购订单界面") # 声明zhongyaoPage类对象 self.goodsDetail_Page = GoodsDetailPage( self.driver, self.url, u"合纵药易购订单界面") # 声明GoodsDetailPage类对象 self.search_page = SearchPage(self.driver, self.url, u"合纵药易购订单界面") # 声明SearchPage类对象 self.driver.implicitly_wait(5) self.ssnr = "阿胶" self.username = username self.password = "******" self.ddbz = "订单备注" self.shuliang = 20 self.public_page.get_url(self.url) self.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 self.public_page.login(self.username, self.password) self.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭
def setUpClass(cls): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.driver.implicitly_wait(5) cls.url = test_url cls.username = username cls.password = "******" # 声明LoginPage类对象 cls.feedback_page = FeedbackPage(cls.driver, cls.url, u"合纵易购反馈界面") cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵易购反馈界面") cls.home_page = HomePage(cls.driver, cls.url, u"合纵易购反馈界面") cls.my_page = MyPage(cls.driver, cls.url, u"合纵易购反馈界面") cls.public_page.get_url(cls.url) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 cls.public_page.login(cls.username, cls.password) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭
def setUpClass(cls): cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.driver.implicitly_wait(5) # 隐式等待 cls.url = test_url cls.username = username cls.password = "******" cls.ssnr = "感冒灵" cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵易购首页界面") # 声明publicMethod类对象 cls.home_page = HomePage(cls.driver, cls.url, u"合纵易购首页界面") # 声明LoginPage类对象 cls.goodsDetail_page = GoodsDetailPage( cls.driver, cls.url, "合纵易购首页界面") # 声明GoodsDetailPage类对象 cls.public_page.get_url(cls.url) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 cls.public_page.login(cls.username, cls.password) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭
def setUpClass(cls): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.driver.implicitly_wait(5) # 隐式等待 cls.url = test_url cls.ddbj = "18056558899" cls.username = username cls.password = "******" cls.xiangsu = "window.scrollBy(0, 700)" # 声明HomePage类对象 cls.home_page = HomePage(cls.driver, cls.url, u"合纵药易购我的界面") # 声明MyPage类对象 cls.my_page = MyPage(cls.driver, cls.url, u"合纵药易购我的界面") # 声明publicMethod类对象 cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵药易购我的界面") cls.public_page.get_url(cls.url) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 cls.public_page.login(cls.username, cls.password) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 sleep(0.5) cls.home_page.click_my()
def setUpClass(cls): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" cls.driver = webdriver.Chrome(executable_path=chromedriver) cls.driver.implicitly_wait(5) # 隐式等待 cls.url = test_url cls.username = username cls.password = "******" cls.public_page = PublicMethod(cls.driver, cls.url, u"合纵易购积分商城界面") # 声明PublicMethod类对象 cls.home_page = HomePage(cls.driver, cls.url, u"合纵易购积分商城界面") # 声明homePage类对象 cls.cart_page = CartPage(cls.driver, cls.url, u"合纵易购积分商城界面") # 声明cartPage类对象 cls.categories_page = CategoriesPage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明categoriesPage类对象 cls.puyao_page = PuYaoPage(cls.driver, cls.url, u"合纵易购积分商城界面") # 声明puyaoPage类对象 cls.settle_page = SettlePage(cls.driver, cls.url, u"合纵易购积分商城界面") # 声明settlePage类对象 cls.goodsdetail_page = GoodsDetailPage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明goodsDetailPage类对象 cls.jfsc_page = JiFenShangChengPage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明jifenshangchengPage类对象 cls.jfscqd_page = JiFenShangCheng_qiandaoPage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明JiFenShangCheng_qiandaoPage类对象 cls.jfsclpc_page = JiFenShangCheng_lipinchePage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明JiFenShangCheng_qiandaoPage类对象 cls.jfscjs_page = JiFenShangCheng_jiesuanPage( cls.driver, cls.url, u"合纵易购积分商城界面") # 声明JiFenShangCheng_jiesuanPage类对象 cls.public_page.get_url(cls.url) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 cls.public_page.login(cls.username, cls.password) cls.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭
class TestLogin(unittest.TestCase): def setUp(self): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" self.driver = webdriver.Chrome(executable_path=chromedriver) self.driver.implicitly_wait(30) self.url1 = login_url self.url2 = tejia_url self.username1 = "测试05" # 非区域会员 self.username2 = "测试06" # 非终端会员 self.username3 = "测试07" # 正常会员 self.password = "******" # 密码 self.public_page = PublicMethod(self.driver, self.url, u"合纵易购特价界面") # 声明publicMethod类对象 self.login_page = LoginPage(self.driver, self.url, u"合纵易购特价界面") # 声明LoginPage类对象 self.tejia_page = TeJiaPage(self.driver, self.url, u"合纵易购特价界面") # 声明TeJiaPage类对象 self.goodDetail_page = GoodsDetailPage( self.driver, self.url, u"合纵易购特价界面") # 声明GoodsDetailPage self.cart_page = CartPage(self.driver, self.url, u"合纵易购特价界面") # 声明cartPage self.home_page = HomePage(self.driver, self.url, u"合纵易购特价界面") # 声明homePage self.settle_page = SettlePage(self.driver, self.url, u"合纵易购特价界面") # 声明settlePage def tearDownClass(self): self.driver.quit() def test_tejia_01(self): """非区域内的会员""" self.public_page.get_url(login_url) # 进入首页 sleep(1) self.public_page.login(self.username1, self.password) # 登录账号 sleep(1) self.public_page.get_url(tejia_url) # 进入特价页面 sleep(1) self.assertEqual(self.tejia_page.text_qyts, "该活动针对非成都地区终端客户!") def test_tejia_02(self): """非终端会员""" self.public_page.get_url(login_url) # 进入首页 sleep(1) self.public_page.login(self.username1, self.password) # 登录账号 sleep(1) self.public_page.get_url(tejia_url) # 进入特价页面 sleep(1) self.assertEqual(self.tejia_page.text_zdts(), "只有终端可以参与活动!") def test_tejia_03(self): """加入购物车""" self.public_page.get_url(login_url) # 进入首页 sleep(1) self.public_page.login(self.username1, self.password) # 登录账号 sleep(1) self.public_page.get_url(tejia_url) # 进入特价页面 sleep(1) self.tejia_page.click_jrgwc() # 加入购物车 sleep(1) self.tejia_page.click_yxgpz() # 进入已选购页面 sleep(1) self.assertEqual(self.tejia_page.text_jrgwc(), "加入购物车") def test_tejia_04(self): """搜索相应商品""" self.public_page.get_url(login_url) # 进入首页 sleep(1) self.public_page.login(self.username1, self.password) # 登录账号 sleep(1) self.public_page.get_url(tejia_url) # 进入特价页面 sleep(1) self.tejia_page.input_ssk("川贝") sleep(1) self.tejia_page.click_ssButton() sleep(1) self.assertEqual(self.tejia_page.text_spTitle(), "川贝粉") def test_tejia_05(self): """商品详情中价格检查""" self.public_page.get_url(login_url) # 进入首页 sleep(1) self.public_page.login(self.username1, self.password) # 登录账号 sleep(1) self.public_page.get_url(tejia_url) # 进入特价页面 sleep(1) a = self.tejia_page.text_tj() # 获取特价价格 sleep(1) self.tejia_page.click_spdt() # 点击商品大图 sleep(1) b = self.goodDetail_page.text_tj() # 获取特价价格 sleep(1) self.assertEqual(a, b) # 判断特价列表和商品详情的价格是否一致 def test_tejia_06(self): """购物车中的价格检查""" self.public_page.get_url(login_url) # 进入首页 sleep(1) self.public_page.login(self.username1, self.password) # 登录账号 sleep(1) self.public_page.get_url(tejia_url) # 进入特价页面 sleep(1) a = self.tejia_page.text_tj() # 获取特价价格 sleep(1) self.tejia_page.click_spdt() # 点击商品大图 sleep(1) self.goodDetail_page.click_jrgwc() # 点击加入购物车 sleep(1) self.home_page.click_gwc() # 点击购物车 sleep(1) b = self.cart_page.text_dj() # 获取单价 sleep(1) self.assertEqual(a, b) def test_tejia07(self): """结算中的价格检查""" self.public_page.get_url(login_url) # 进入首页 sleep(1) self.public_page.login(self.username1, self.password) # 登录账号 sleep(1) self.public_page.get_url(tejia_url) # 进入特价页面 sleep(1) a = self.tejia_page.text_tj() # 获取特价价格 sleep(1) self.tejia_page.click_spdt() # 点击商品大图 sleep(1) self.goodDetail_page.click_jrgwc() # 点击加入购物车 sleep(1) self.home_page.click_gwc() # 点击购物车 sleep(1) self.cart_page.click_jiesuan() # 点击结算 sleep(1) b = self.settle_page.text_dj() # 获取单价 sleep(1) self.assertAlmostEqual(a, b)
class TestOrderProcess(unittest.TestCase): @classmethod def setUpClass(cls): pass def setUp(self): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" self.driver = webdriver.Chrome(executable_path=chromedriver) self.url = test_url self.public_page = PublicMethod(self.driver, self.url, u"合纵药易购订单界面") # 声明publicMethod类对象 self.categories_page = CategoriesPage( self.driver, self.url, u"合纵药易购订单界面") # 声明categoriesPage类对象 self.home_page = HomePage(self.driver, self.url, u"合纵药易购订单界面") # 声明homepage类对象 self.puyao_page = PuYaoPage(self.driver, self.url, u"合纵药易购订单界面") # 声明puyaopage类对象 self.jpzq_page = JingPinZhuanQuPage( self.driver, self.url, u"合纵药易购订单界面") # 声明jingpinzhuanqu类对象 self.settle_page = SettlePage(self.driver, self.url, u"合纵药易购订单界面") # 声明settlepage类对象 self.cart_page = CartPage(self.driver, self.url, u"合纵药易购订单界面") # 声明cartpage类对象 self.order_page = OrderPage(self.driver, self.url, u"合纵药易购订单界面") # 声明orderpage类对象 self.zhongyao_page = ZhongYaoPage(self.driver, self.url, u"合纵药易购订单界面") # 声明zhongyaoPage类对象 self.goodsDetail_Page = GoodsDetailPage( self.driver, self.url, u"合纵药易购订单界面") # 声明GoodsDetailPage类对象 self.search_page = SearchPage(self.driver, self.url, u"合纵药易购订单界面") # 声明SearchPage类对象 self.driver.implicitly_wait(5) self.ssnr = "阿胶" self.username = username self.password = "******" self.ddbz = "订单备注" self.shuliang = 20 self.public_page.get_url(self.url) self.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 self.public_page.login(self.username, self.password) self.public_page.is_element_exist() # 判断广告页是否弹出,弹出自动关闭 def tearDown(self): self.driver.quit() sleep(2) @classmethod def tearDownClass(cls): # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe" # cls.driver = webdriver.Chrome(executable_path=chromedriver) # cls.driver.quit() pass def test_OrderProcess_01(self): """测试下单前检查清除购物车商品""" sleep(1) self.categories_page.click_py() # 点击进入普药列表 sleep(2) self.home_page.click_gwc() # 进入购物车界面 sleep(1) self.cart_page.is_scsp_exist() # 判断是否存在商品 sleep(1) self.driver.back() # 返回首页 sleep(1) self.public_page.is_element_exist() # 判断广告也是否弹出,弹出自动关闭 def test_OrderProcess_02(self): """在普药中选择商品进行下单""" sleep(2) self.categories_page.click_py() # 点击普药进入普药列表 sleep(0.5) for i in range(3): sleep(1) self.puyao_page.click_addcart(i) # 点击第一个商品加入购物车 sleep(2) self.home_page.click_gwc() # 进入购物车界面 for i in range(3): sleep(1) self.cart_page.input_number1(self.shuliang, i) sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 sleep(1) self.public_page.click_tckLeft() # 结算后的提示框点击 sleep(1) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(1) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_03(self): """在精品专区中选择商品进行下单""" sleep(2) self.categories_page.click_jpzq() # 点击精品专区进入精品列表 for i in range(3): sleep(2) self.jpzq_page.click_addcart(i) # 输入第一个商品加入购物车 sleep(1) self.home_page.click_gwc() # 进入购物车界面 sleep(2) for i in range(3): sleep(1) self.cart_page.input_number1(self.shuliang, i) sleep(0.5) self.cart_page.click_jiage() sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_04(self): """在中药专区选择商品进行下单""" sleep(1) self.categories_page.click_zyzq() # 点击进入中药专区 sleep(1) self.zhongyao_page.click_ljqg(0) # 点击第一个商品立即抢购 sleep(1) self.public_page.switch_secendPage() # 句柄切换到第二页中 sleep(1) self.goodsDetail_Page.click_jrgwc() # 点击加入购物车 sleep(1) self.driver.close() # 退出商品详情页面 sleep(1) self.public_page.switch_home() # 句柄切换到首页 sleep(1) self.zhongyao_page.click_ljqg(1) # 点击第二个商品立即抢购 sleep(1) self.public_page.switch_secendPage() # 句柄切换到第二页 sleep(1) self.goodsDetail_Page.click_jrgwc() # 点击加入购物车 sleep(1) self.goodsDetail_Page.click_gwc() # 点击购物车按钮 for i in range(2): sleep(1) self.cart_page.input_number1(self.shuliang, i) # 输入第一个商品的数量 sleep(1) self.cart_page.click_jiage() sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_05(self): """呼吸系统用药商品下单""" sleep(2) self.categories_page.click_qbspfl(0) # 点击进入呼吸系统分类选择 sleep(0.5) self.categories_page.click_list1_1() # 点击进入抗感冒类界面 sleep(1) self.public_page.switch_secendPage() # 句柄切换到第二页上 for i in range(2): sleep(0.5) self.puyao_page.click_addcart(i) # 商品1加入购物车 sleep(2) self.home_page.click_gwc() # 调用进入购物车界面按钮 sleep(0.5) self.cart_page.input_number1(self.shuliang, 0) # 输入第一个商品的数量 sleep(2) self.cart_page.input_number1(self.shuliang, 1) # 输入第二个商品的数量 sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_06(self): """清热消炎商品下单""" sleep(0.5) self.categories_page.click_qbspfl(1) # 点击进入呼吸系统分类选择 sleep(0.5) self.categories_page.click_list2_1() # 点击进入抗感冒类界面 sleep(0.5) self.public_page.switch_secendPage() # 句柄切换到第二页上 for i in range(3): sleep(1) self.puyao_page.click_addcart(i) # 商品1加入购物车 sleep(5) self.home_page.click_gwc() # 调用进入购物车界面按钮 for i in range(3): sleep(1) self.cart_page.input_number1(self.shuliang, i) # 给一二三个商品添加数量 sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_07(self): """五官皮肤及外用商品下单""" sleep(0.5) self.categories_page.click_qbspfl(2) # 点击进入呼吸系统分类选择 sleep(0.5) self.categories_page.click_list3_1() # 点击进入抗感冒类界面 sleep(0.5) self.public_page.switch_secendPage() # 句柄切换到第二页上 for i in range(3): sleep(1) self.puyao_page.click_addcart(i) # 商品1加入购物车 sleep(2) self.home_page.click_gwc() # 调用进入购物车界面按钮 sleep(1) for i in range(2): self.cart_page.input_number1(self.shuliang, 0) # 调用给第一个商品输入数量 sleep(2) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_08(self): """补益安神及维矿类商品下单""" sleep(0.5) self.categories_page.click_qbspfl(4) # 点击进入呼吸系统分类选择 sleep(0.5) self.categories_page.click_list5_1() # 点击进入抗感冒类界面 sleep(0.5) self.public_page.switch_secendPage() # 句柄切换到第二页上 for i in range(3): sleep(1) self.puyao_page.click_addcart(i) # 商品1加入购物车 sleep(2) self.home_page.click_gwc() # 调用进入购物车界面按钮 sleep(1) for i in range(3): self.cart_page.input_number1(self.shuliang, i) # 输入第一个商品的数量 sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_09(self): """商品分类——妇、儿科列表""" sleep(0.5) self.categories_page.click_qbspfl(5) # 点击进入呼吸系统分类选择 sleep(0.5) self.categories_page.click_list6_1() # 点击进入抗感冒类界面 sleep(0.5) self.public_page.switch_secendPage() # 句柄切换到第二页上 sleep(1) for i in range(3): self.puyao_page.click_addcart(i) # 商品1加入购物车 sleep(1) sleep(1) self.home_page.click_gwc() # 调用进入购物车界面按钮 sleep(1) for i in range(3): self.cart_page.input_number1(self.shuliang, i) # 输入第N个商品的数量 sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_10(self): """商品分类——心脑血管及神经类用药列表""" sleep(0.5) self.categories_page.click_qbspfl(6) # 点击进入呼吸系统分类选择 sleep(0.5) self.categories_page.click_list7_1() # 点击进入抗感冒类界面 sleep(0.5) self.public_page.switch_secendPage() # 句柄切换到第二页上 for i in range(2): sleep(1) self.puyao_page.click_addcart(i) # 商品2加入购物车 sleep(5) self.home_page.click_gwc() # 调用进入购物车界面按钮 sleep(1) for i in range(3): self.cart_page.input_number1(self.shuliang, i) # 输入第一个商品的数量 sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_11(self): """商品分类——风湿骨伤及其他药品列表""" sleep(0.5) self.categories_page.click_qbspfl(8) # 点击进入呼吸系统分类选择 sleep(0.5) self.categories_page.click_list9_1() # 点击进入抗感冒类界面 sleep(0.5) self.public_page.switch_secendPage() # 句柄切换到第二页上 for i in range(2): sleep(1) self.puyao_page.click_addcart(i) # 商品2加入购物车 sleep(2) self.home_page.click_gwc() # 调用进入购物车界面按钮 sleep(1) for i in range(3): self.cart_page.input_number1(self.shuliang, i) # 输入第一个商品的数量 sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_12(self): """商品分类——非药品列表""" sleep(0.5) self.categories_page.click_qbspfl(11) # 点击进入呼吸系统分类选择 sleep(0.5) self.categories_page.click_list12_1() # 点击进入抗感冒类界面 sleep(0.5) self.public_page.switch_secendPage() # 句柄切换到第二页上 for i in range(2): sleep(1) self.puyao_page.click_addcart(i) # 商品2加入购物车 sleep(2) self.home_page.click_gwc() # 调用进入购物车界面按钮 sleep(0.5) for i in range(3): self.cart_page.input_number1(self.shuliang, i) # 输入第一个商品的数量 sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_13(self): """搜索内容进行下单""" sleep(1) self.search_page.input_ssk("阿胶") # 搜索框中输入内容 sleep(1) self.search_page.click_ssButton() # 点击搜索按钮 sleep(1) for i in range(2): sleep(1) self.puyao_page.click_addcart(i) # 商品2加入购物车 sleep(2) self.home_page.click_gwc() # 调用进入购物车界面按钮 sleep(0.5) for i in range(2): self.cart_page.input_number1(self.shuliang, i) # 输入第一个商品的数量 sleep(1) sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮 # sleep(0.5) # self.settle_page.click_tjdd() # 点击提交订单 # sleep(0.5) # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!") def test_OrderProcess_14(self): """搜索框联想的内容进行下单""" sleep(2) self.search_page.input_ssk("阿胶") # 搜索框中输入内容 sleep(2) self.search_page.click_ssList1(0) # 点击搜索列表第一个 sleep(2) for i in range(2): sleep(1) self.puyao_page.click_addcart(i) # 商品2加入购物车 sleep(2) self.home_page.click_gwc() # 调用进入购物车界面按钮 sleep(0.5) for i in range(2): self.cart_page.input_number1(self.shuliang, i) # 输入第一个商品的数量 sleep(1) sleep(1) self.cart_page.click_jiesuan() # 点击结算按钮