def test_orderupdate(self): """ 这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。 :return: """ homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_trade_module() #点击打单模块 time.sleep(2) homepage.click_trade() #点击打单发货 time.sleep(3) homepage.nowwindow() #当前窗口 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 homepage.click_update_data() #点击更新数据 time.sleep(2) driver = self.driver #初始化 update_data_framedata = driver.find_element_by_xpath( "//*[@id='progress']/div/div/div[1]").text # 更新数据进度框标题 print update_data_framedata try: assert '订单更新' in update_data_framedata print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_test1(self): # homepage = SuperHomePage(self.driver) # homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 # time.sleep(2) # for link in self.driver.find_elements_by_xpath("//*[@id]"): # print (link.get_attribute('id')) homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_cuxiao_module() # 点击促销模块 time.sleep(2) homepage.click_cuxiao_zk() # 点击折扣 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) zk_text_link = "xpath=>.//*[@id='myNextStep']" # 折扣 el = homepage.get_text(zk_text_link) try: assert '限时折扣' in homepage.get_page_title() and '下一步:选择宝贝' in el # 调用页面对象继承基类中的获取页面标题方法 #assert '下一步:选择宝贝' in el print ('Test Pass.') except Exception as e: print ('Test Fail.', format(e))
def test_shangpin_cctj(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_shangpin_module() # 点击商品模块 time.sleep(2) homepage.click_shangpin_cctj() # 点击橱窗推荐 homepage.nowwindow() # 当前窗口 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 try: assert '橱窗首页' in homepage.get_page_title() # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_jiaoyi_cps(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_jiaoyi_module() # 点击交易模块 time.sleep(2) homepage.click_jiaoyi_cps() # 点击差评师拦截 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) try: assert '差评师拦截' in homepage.get_page_title() # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_shoutao_kjjl(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_shoutao_module() # 点击手淘模块 time.sleep(2) homepage.click_shoutao_kjjl() # 点击快捷奖励 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) try: assert '定向折扣' in homepage.get_page_title() # 调用页面对象继承基类中的获取页面标题方法 print ('Test Pass.') except Exception as e: print ('Test Fail.', format(e))
def test_sms_hyyx(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_sms_module() # 点击短信模块 time.sleep(2) homepage.click_sms_hyyx() # 点击会员营销 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) try: assert '会员数据分析' in homepage.get_page_title() # 调用页面对象继承基类中的获取页面标题方法 print ('Test Pass.') except Exception as e: print ('Test Fail.', format(e))
def test_trade_dpyhq(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_trade_module() # 点击打单模块 time.sleep(2) homepage.click_trade_tool() # 点击实用工具 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) try: assert '消息中心' in homepage.get_page_title() # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_superboss(self): """ 这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。 :return: """ homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法 time.sleep(2) homepage.click_update() # 调用页面对象类中的点击搜索按钮方法 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 try: assert '超级店长' in homepage.get_page_title() # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_moban_pjtj(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_moban_module() # 点击模板模块 time.sleep(2) homepage.click_moban_pjtj() # 点击评价推荐 homepage.nowwindow() # 当前窗口 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 pj_text_link = "xpath=>.//*[@id='container']/div/div[1]/div/div[2]/div[2]/div/div[1]/div[1]/table/tbody/tr[2]/td[3]/span" el = homepage.get_text(pj_text_link) try: assert '评价推荐' in homepage.get_page_title( ) and '查询' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_moban_hdhb(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_moban_module() # 点击模板模块 time.sleep(2) homepage.click_moban_hdhb() # 点击活动海报 homepage.nowwindow() # 当前窗口 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 hd_text_link = "xpath=>.//*[@id='detailHaibao']/span" el = homepage.get_text(hd_text_link) try: assert '创建海报' in homepage.get_page_title( ) and '750详情海报' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_moban_mfkt(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_moban_module() # 点击模板模块 time.sleep(2) homepage.click_moban_mfkt() # 点击魔法抠图 homepage.nowwindow() # 当前窗口 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 kt_text_link = "xpath=>.//*[@id='cutMain-search']" el = homepage.get_text(kt_text_link) try: assert '魔法抠图' in homepage.get_page_title( ) and '搜索宝贝' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_moban_ccmb(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_moban_module() # 点击模板模块 time.sleep(2) homepage.click_moban_ccmb() # 点击尺寸模板 homepage.nowwindow() # 当前窗口 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 cc_text_link = "xpath=>.//*[@id='J_slt-industry-btns']/span[1]" el = homepage.get_text(cc_text_link) try: assert '尺寸模板' in homepage.get_page_title( ) and '全部' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_moban_kfmb(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_moban_module() # 点击模板模块 time.sleep(2) homepage.click_moban_kfmb() # 点击客服模板 homepage.nowwindow() # 当前窗口 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 kf_text_link = "xpath=>.//*[@id='templ-box-2512']/div[2]/div[2]/div/a" el = homepage.get_text(kf_text_link) try: assert '客服模板' in homepage.get_page_title( ) and '开始制作' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_moban_ztsy(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_moban_module() # 点击模板模块 time.sleep(2) homepage.click_moban_ztsy() # 点击主图水印 homepage.nowwindow() # 当前窗口 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 zt_text_link = "xpath=>.//*[@id='container']/div/div[1]/div/div/div[1]/ul/li[1]/span" el = homepage.get_text(zt_text_link) try: assert '折扣水印' in homepage.get_page_title( ) and '折扣水印' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_moban_ztsp(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_moban_module() # 点击模板模块 time.sleep(2) homepage.click_moban_ztsp() # 点击主图视频 homepage.nowwindow() # 当前窗口 time.sleep(2) homepage.get_windows_img() # 调用基类截图方法 sp_text_link = "xpath=>.//*[@id='J-ui-step']/div[2]/div/div[1]/div[1]/div/span[3]/form/span" el = homepage.get_text(sp_text_link) try: assert '主图视频' in homepage.get_page_title( ) and '搜索宝贝' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_cuxiao_cxgj(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_cuxiao_module() # 点击促销模块 time.sleep(2) homepage.click_cuxiao_cxgj() # 点击促销工具 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) cx_text_link = "xpath=>.//*[@id='notend-tab']/span" el = homepage.get_text(cx_text_link) try: assert '活动工具' in homepage.get_page_title( ) and '未结束活动' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_cuxiao_xsxg(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_cuxiao_module() # 点击促销模块 time.sleep(2) homepage.click_cuxiao_xsxg() # 点击限时限购 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) xg_text_link = "xpath=>.//*[@id='myNextStep']" # 折扣 el = homepage.get_text(xg_text_link) try: assert '限购' in homepage.get_page_title( ) and '下一步:选择宝贝' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_cuxiao_wxyx(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_cuxiao_module() # 点击促销模块 time.sleep(2) homepage.click_cuxiao_wxyx() # 点击无线营销 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) wx_text_link = "xpath=>.//*[@id='activityList']/div[2]/div[1]/div/div/div/div/div[2]/div" el = homepage.get_text(wx_text_link) try: assert '活动列表' in homepage.get_page_title( ) and '进行中' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_cuxiao_dpyhq(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_cuxiao_module() # 点击促销模块 time.sleep(2) homepage.click_cuxiao_dpyhq() # 点击店铺优惠券 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) yhq_text_link = "xpath=>.//*[@id='J_app-pages']/div/div[1]/div/div[1]/div[3]/a" el = homepage.get_text(yhq_text_link) try: assert '优惠券' in homepage.get_page_title( ) and '优惠券列表' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_cuxiao_bgyx(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_cuxiao_module() # 点击促销模块 time.sleep(2) homepage.click_cuxiao_bgyx() # 点击包裹营销 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) bg_text_link = "xpath=>.//*[@id='main-nav']/a[1]" el = homepage.get_text(bg_text_link) try: assert '超级卡片' in homepage.get_page_title( ) and '首页' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_cuxiao_hdyx(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_cuxiao_module() # 点击促销模块 time.sleep(2) homepage.click_cuxiao_hdyx() # 点击互动营销 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 time.sleep(2) hd_text_link = "xpath=>.//*[@id='active-list-nav']/li[1]/span" el = homepage.get_text(hd_text_link) try: assert '互动营销' in homepage.get_page_title( ) and '正在进行中' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))
def test_cuxiao_azwtg(self): homepage = SuperHomePage(self.driver) homepage.click_home() # 调用页面对象类中的点击搜索按钮方法,点击首页 time.sleep(2) homepage.click_cuxiao_module() # 点击促销模块 time.sleep(2) homepage.click_cuxiao_zwtg() # 点击站外推广 homepage.nowwindow() # 当前窗口 time.sleep(4) homepage.get_windows_img() # 调用基类截图方法 homepage.close_popup() # 点击弹出上面的确认按钮 time.sleep(2) zw_text_link = "xpath=>.//*[@id='container']/div/div[1]/div/div[1]/div[1]/div" el = homepage.get_text(zw_text_link) try: assert '账号管理' in homepage.get_page_title( ) and '绑定' in el # 调用页面对象继承基类中的获取页面标题方法 print('Test Pass.') except Exception as e: print('Test Fail.', format(e))