def allKe(self): Ads.test_ketang_ad(self) screen = swipe.get_size(self) list = isElement.find_Element(self,'id',"recycler_list") if list: print("看到了全部课程") return True else: size=0 while size==0: self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 7000) list = isElement.find_Element(self, 'id', "recycler_list") if list: print("看到了全部课程") try: llParent = self.driver.find_elements_by_id('recycler_list')[0].find_element_by_id("tv_num").is_displayed() if llParent: return True else: self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 6000) except: print("2") else: size = 0 print("看到了全部课程") return True
def miniPlay_play(self): flag=isMiniPlays.isMiniPlay(self) if flag: #判断全局播放器是暂停还是播放状态 close=isElement.find_Element(self,'id','iv_close') if close: print("全局播放器为暂停,点击播放") self.driver.find_element_by_id('iv_play_state').click() close = isElement.find_Element(self, 'id', 'iv_close') if close: print("未播放") return else: print("播放成功") return else: print("全局播放器为播放,点击暂停") self.driver.find_element_by_id('iv_play_state').click() close = isElement.find_Element(self, 'id', 'iv_close') if close: print("未播放") return else: print("播放成功") return else: print("未有全局播放器") return
def play_manuscripts(self): # 左滑页面 screen = swipe.get_size(self) self.driver.swipe(screen[0] * 0.75, screen[1] * 0.5, screen[0] * 0.05, screen[1] * 0.5, 6000) sleep(5) flag = isElements.find_Element(self, 'id', 'wiki_play_detail_pager') if flag: print("切换到文稿") # 判断该音频是否有文稿 line = isElements.find_Element( self, 'id', 'rl_wiki_play_detail_lineWaveVoiceView') if line: print("暂无文稿") else: print("该音频有文稿,滑动查看文稿") self.driver.swipe(50 * 0.5, 180 * 0.75, 500 * 0.5, 700, 6000) sleep(5) # 切换到大咖头像页 screen1 = swipe.get_size(self) self.driver.swipe(screen1[0] * 0.05, screen1[1] * 0.5, screen1[0] * 0.75, screen1[1] * 0.5, 6000) # 判断是否切换成功 play = isElements.find_Element(self, 'id', 'iv_wiki_play_detail_play') if play: print("切换到了大咖头像页") else: print("未切换") else: print("未切换到文稿")
def groupBooking_course(self): flag = isElement.find_Element(self, "id", 'com.mbalib.android.wiki:id/recycler_list') if not flag: screen = swipe.get_size(self) self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 6000) # 点击系统班的第一个课程包 list = self.driver.find_elements_by_id( "com.mbalib.android.wiki:id/recycler_list" )[0].find_elements_by_class_name("android.widget.LinearLayout") list[0].click() sleep(5) #先判断课程是否已报名 ll_bottom_pay = isElement.find_Element(self, 'id', 'll_bottom_pay') if ll_bottom_pay: print("该课程未报名,判断该课程是否为拼团") tv_ke_group_book = isElement.find_Element(self, 'id', 'tv_ke_group_book') if tv_ke_group_book: print("该课程是拼团") self.driver.find_element_by_id('tv_ke_group_book').click() sleep(3) self.driver.find_element_by_name('支付宝支付').click() sleep(6) else: print("该课程没有拼团") else: print("该课程已报名")
def test_scene_list_to_play(self, isVip): empty = isElement.find_Element(self, 'id', 'layout_ll_empty') if empty: print("该场景暂无数据") else: print("该场景有数据") # 点击vip音频可进行播放 list = self.driver.find_elements_by_id('ll_parent')[ 1].find_elements_by_class_name('android.widget.RelativeLayout') flag = list[0].find_element_by_id('ivImageVip').is_enabled() list[0].click() sleep(5) if flag: print("该音频是vip音频") if isVip: print("用户是vip,进入播放页") else: print("用户不是vip用户,触发开通弹窗") parentPanel = isElement.find_Element(self, 'id', 'parentPanel') if parentPanel: print("触发了开通提示弹窗") else: print("未触发") else: print("该音频不是vip音频,不管用户是否为vip都进入播放页") # 判断进入的是否为播放页 play = isElement.find_Element(self, 'id', 'rl_wiki_play_detail_top') if play: print("进入播放页") else: print("未进入播放页")
def test_search_ad(self): print('搜索首页广告') # 判断是否有闪屏广告 Ad.test_ad(self) # 判断是否有首页广告 Ad.test_is_ad(self) self.driver.find_element_by_id('toolbar_iv_search').click() sleep(5) #收起键盘 self.driver.hide_keyboard() #点击首个广告:目前是大咖广告 self.driver.find_elements_by_id( "com.mbalib.android.wiki:id/image")[0].click() back.ivBack(self) #点击每日一词,有句名言,智库早报 print('进入每日一词') self.driver.find_elements_by_id( 'com.mbalib.android.wiki:id/ivImge')[0].click() back.ivBack(self) print('进入有句名言') self.driver.find_elements_by_id( 'com.mbalib.android.wiki:id/ivImge')[1].click() back.ivBack(self) print('进入智库早报') self.driver.find_elements_by_id( 'com.mbalib.android.wiki:id/ivImge')[2].click() back.ivBack(self) print("进入搜索广告位") self.driver.find_elements_by_id( "com.mbalib.android.wiki:id/image")[1].click() back.ivBack(self) #切换到课堂 print("切换到课堂搜索页") self.driver.find_element_by_name('课堂').click() #判断是否有广告 print("判断课堂搜索页是否有广告") IvImageAd = isElement.find_Element(self, 'id', 'IvImageAd') if IvImageAd: print("存在课堂搜索页广告") self.driver.find_element_by_id('IvImageAd').click() sleep(5) back.ivBack(self) else: print("不存在课堂搜索页广告") #切换到资讯搜索页 print("切换到资讯搜索页") self.driver.find_element_by_name('资讯').click() IvImageAd = isElement.find_Element(self, 'id', 'IvImageAd') if IvImageAd: print("存在资讯搜索页广告") self.driver.find_element_by_id('IvImageAd').click() sleep(5) back.ivBack(self) else: print("不存在资讯搜索页广告") sleep(5)
def ivBack(self): iv_back = isElement.find_Element(self, 'id', 'toolbar_iv_back') print('判断返回的id:', iv_back) if iv_back: self.driver.find_element_by_id('toolbar_iv_back').click() elif isElement.find_Element(self, 'id', 'iv_back'): self.driver.find_element_by_id('iv_back').click() print('返回到首页') #elif self.driver.find_element_by_name('开通').is_displayed(): #self.driver.find_element_by_name('取消').click() else: print('无链接')
def no_name_filled(self): # 判断姓名是否存在 name = isElement.find_Element(self, 'id', 'etEditName') if name: print("存在姓名,不输入数据") # 判断公司是否存在 company = isElement.find_Element(self, 'id', 'etEditCompany') if company: print("存在公司,输入数据") self.driver.find_element_by_id('etEditCompany').send_keys('MBA') # 关闭键盘 self.driver.hide_keyboard() else: print("不存在公司,不用输入数据") # 判断职务是否存在 etEditJob = isElement.find_Element(self, 'id', 'etEditJob') if etEditJob: print("存在职务,输入数据") self.driver.find_element_by_id('etEditJob').send_keys('test') # 关闭键盘 self.driver.hide_keyboard() else: print("不存在职务,不输入数据") # 判断地区是否存在 tvAddress = isElement.find_Element(self, 'id', 'tvAddress') if tvAddress: self.driver.find_element_by_id('tvAddress').click() print("存在地区,输入数据") # 选择省 # self.driver.find_element_by_id('options1').click() # 滑动 # self.driver.swipe(20,722,180,960,200) # sleep(5) # 选择市 # self.driver.find_element_by_id('options2').click() # 滑动 # self.driver.swipe(190,722,360,960,200) # 选择区 # self.driver.find_element_by_id('options3').click() # 滑动 # self.driver.swipe(400, 722, 540,960,200) # sleep(3) self.driver.find_element_by_id('btnSubmit').click() else: print("不存在地区,不输入数据") sleep(5) # 提交信息补充数据 self.driver.find_element_by_id('tvConfirm').click()
def Mbi(self): #self.driver.find_elements_by_id('tv_tab_title')[4].click() name = isElement.find_Element(self, 'id', 'tv_my_fragment_M_bi') while not name: screen = swipe.get_size(self) self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 6000) name = isElement.find_Element(self, 'name', 'M币') self.driver.find_element_by_id('tv_my_fragment_M_bi').click() sleep(5) mcoin = self.driver.find_element_by_id('tv_mcoin').text #去掉符号 money = mcoin.strip('¥') return money
def ke_course_audition_noBuy(self): """未报名点击章节试听""" # 切换到课堂 self.driver.find_element_by_name('课堂').click() sleep(5) ad.test_ketang_ad(self) sleep(3) isMini = isMiniPlays.isMiniPlay(self) if isMini: self.driver.find_element_by_id('iv_close').click() flag = isElement.find_Element(self, "id", 'com.mbalib.android.wiki:id/recycler_list') while not flag: screen = swipe.get_size(self) self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 6000) flag = isElement.find_Element(self, "id", 'com.mbalib.android.wiki:id/recycler_list') # 点击全部课程的第一个课程 list = self.driver.find_element_by_id("com.mbalib.android.wiki:id/recycler_list").find_elements_by_id("llParent") list[0].click() sleep(5) # 判断课程是否报名 tvBuy = isElement.find_Element(self, 'id', 'tv_buy') if tvBuy: # 未报名 print("该课程未报名") tabTitle = isElement.find_Element(self, 'id', 'tv_tab_title') while not tabTitle: screen = swipe.get_size(self) self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 3000) tabTitle = isElement.find_Element(self, 'id', 'tv_tab_title') self.driver.find_elements_by_id("com.mbalib.android.wiki:id/tv_tab_title")[1].click() sleep(3) #判断该课程是否有试听章节 listen=isElement.find_Element(self,'id','tv_try_listen') while not listen: screen = swipe.get_size(self) self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 6000) listen = isElement.find_Element(self, 'id', 'tv_try_listen') self.driver.find_elements_by_id('com.mbalib.android.wiki:id/recycler')[0].find_elements_by_id('note_iv_title')[0].click() sleep(5) # 进入播放页 thumb = isElement.find_Element(self, 'id', 'com.mbalib.android.wiki:id/layout_play_view') sleep(5) if thumb: print("成功进入播放页") self.driver.find_element_by_id('play_view').click() self.driver.find_element_by_id('iv_back').click() playState = isElement.find_Element(self, 'id', 'iv_close') if playState: print("课程未自动播放") else: print("课程有自动播放") else: #已报名 print("该课程已报名")
def test_vipAduioPlay(self): # 判断是否有闪屏广告 AdTest.Ad.test_ad(self) # 判断是否有首页广告 AdTest.Ad.test_is_ad(self) sleep(5) print("点击首页的【今日推荐】的音频进入大咖播放页") #用户是否为VIP用户 isVip = IsVip.isVip(self) back.ivBack(self) sleep(5) # 点击的是否为试听音频 aduio = self.driver.find_elements_by_id( "com.mbalib.android.wiki:id/wikiAudioRecycler" )[0].find_elements_by_class_name("android.widget.RelativeLayout") print("audio", aduio) try: aduioIsVip = aduio[0].find_element_by_id('imageVip').is_displayed() except: aduioIsVip = False if isVip: print("点击音频进入大咖播放页") aduio[0].find_element_by_id('tv_title').click() sleep(5) else: #用户不是VIP用户则需判断音频是否为试听音频 if aduioIsVip: print("该音频是非试听音频") aduio[0].find_element_by_id('tv_title').click() sleep(5) #触发分享弹窗或者开通VIP弹窗 tvOpen = isElement.find_Element(self, 'id', 'tvOpen') #点击【开通vip】 if tvOpen: print("有触发弹窗") self.driver.find_element_by_id('tvOpen').click() sleep(5) #进入开通vip页面,判断是否进入的是开通vip页面 tvPay = isElement.find_Element(self, 'id', 'tvPay') if tvPay: print("进入开通vip页面") else: print("未进入开通vip页面") else: print("无触发弹窗") else: print("该音频是试听音频") aduio[0].find_element_by_id('tv_title').click() sleep(5)
def m_pay(self,money): print("M币支付-报名-不使用优惠券") tv_money=self.driver.find_element_by_id('tv_money').text[1:] tv_money=tv_money[1:] money = money[1:] money = money[1:] flag = float(tv_money) > float(money) if flag: print("M币余额不足,点击则触发是否去充值") self.driver.find_element_by_id('tv_mcoin').click() sleep(3) self.driver.find_element_by_id('ask_tv_confirm').click() title=self.driver.find_element_by_id('toolbar_tv_title').text if title=='我的M币': print("跳转到M币充值页") else: print("未跳转到M币充值页") self.driver.quit() else: self.driver.find_element_by_id('tv_mcoin').click() self.driver.find_element_by_id('btn_pay').click() sleep(5) pay_bottom=isElement.find_Element(self,'id','ll_bottom_pay') if pay_bottom: print("支付不成功") else: print("支付成功")
def play_is_downloaded(self): print("判断当前在播放的视音频是否在【已下载】列表中") # 切换到我的 self.driver.find_element_by_name('我的').click() sleep(3) # 选择【下载】 self.driver.find_element_by_name('下载').click() sleep(3) mini = isElement.find_Element(self, 'id', 'll_mini_parent') if mini: print("当前正在播放") #判断当前播放的是否已下载 list = self.driver.find_elements_by_id( 'com.mbalib.android.wiki:id/recycler')[0].find_elements_by_id( 'tvTitle') tv_title = self.driver.find_element_by_id('tv_title').text #判断当前页面有几条已下载数据 size = len(list) print("当前播放章节标题:", tv_title) for index in range(size): text = list[index].text print("循环列表,当前章节标题", text) if tv_title == text: print("当前播放的音频已下载 ") else: print("当前播放的音频未下载") else: print("当前未在播放")
def download_ke(self): print("从【我的课程】进入课程介绍页下载课程") # 切换到我的 self.driver.find_element_by_name('我的').click() sleep(3) # 选择【课程】 self.driver.find_element_by_name('课程').click() sleep(3) list =self.driver.find_elements_by_id('com.mbalib.android.wiki:id/layout_recycler')[0].find_elements_by_id('com.mbalib.android.wiki:id/tv_title') print("我的课程数据:",list) if len(list) != 0: # 点击进入课程介绍页 list[0].click() sleep(5) #介绍页点击【XX学习】 self.driver.find_element_by_id('tv_study').click() sleep(5) print("判断是否下载") isDownLoda = isElement.find_Element(self, 'id', 'ivDownloadConplete') if isDownLoda: print("已下载") else: print("还未下载,点击下载") self.driver.find_element_by_id('imageDownload').click() sleep(5) else: # 该用户未报名 print("用户未报名过")
def adBase(self): print("启动APP后到首页的广告及所有弹窗判断") # 隐私政策 privacyPolicy.privacy_policy_agree(self) sleep(5) # 闪屏广告 splashAd.test_noSkip(self) sleep(3) # 引导图 layoutIvBg.test_layout_iv_bg(self) sleep(5) #更新提醒 advertisement.test_ask_tv_cancel(self) sleep(5) # 账号安全提示 flag = isElements.find_Element(self, 'id', 'tv_sure') if flag: print("账号安全提示-登录限制弹窗显示") self.driver.find_element_by_id('tv_sure').click() sleep(5) self.driver.find_elements_by_id('tv_tab_title')[3].click() sleep(5) # 首页弹窗广告 advertisement.test_is_ad(self) sleep(5)
def m_pay_cancle(self,money): print("M币支付-报名-不使用优惠券") tv_money=self.driver.find_element_by_id('tv_money').text[1:] tv_money=tv_money[1:] money=money[1:] money=money[1:] flag=float(tv_money)>float(money) if flag: print("M币余额不足,点击则触发是否去充值") self.driver.find_element_by_id('tv_mcoin').click() sleep(3) self.driver.find_element_by_id('ask_tv_cancel').click() print("M币余额不足,取消充值") return False else: self.driver.find_element_by_id('tv_mcoin').click() self.driver.find_element_by_id('btn_pay').click() sleep(5) pay_bottom=isElement.find_Element(self,'id','ll_bottom_pay') if pay_bottom: print("支付不成功") return False else: print("支付成功") return True
def isVip(self): print("是否为大咖vip") #切换到【我的】 self.driver.find_element_by_name('我的').click() # 判断是否登录 isLogin = isElement.find_Element(self, 'id', 'tv_my_fragment_login_no_login') if isLogin: # 登录账号 self.driver.find_element_by_id('tv_my_fragment_login_no_login').click() sleep(5) login.login_userName(self) flag = self.driver.find_element_by_xpath( '//android.view.View[@content-desc="绑定 绑定"]').is_enabled() if flag: back.ivBack(self) else: print("有登录") # 判断是否为vip text = self.driver.find_element_by_id('tv_my_fragment_vip_wiki_date').text print("大咖vip", text) if text == '已失效': return '已失效' elif text == "未开通": return '未开通' else: return 'vip'
def isMiniPlay(self): #判断是否有全局播放器 flag = isElements.find_Element(self, 'id', 'll_mini_parent') if flag: return True else: return False
def isVip(self): print("是否为大咖vip") # 判断是否有闪屏广告 AdTest.Ad.test_ad(self) # 判断是否有首页广告 AdTest.Ad.test_is_ad(self) sleep(5) #判断是否有首页横幅广告,有的话则往上滑动,显示出大咖讲百科内容 hengfu = isElement.find_Element(self, 'id', 'iv_home_wiki') if hengfu: print('向上滑动') screen = swipe.get_size(self) self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 6000) else: print('不存在横幅广告') print("从首页的【今日推荐】的【大咖讲百科】进入大咖首页") self.driver.find_elements_by_id('ivSection')[0].click() sleep(5) tvDesc = self.driver.find_element_by_id('tvdesc').text print("tvdesc的值:", tvDesc) if tvDesc == '专享大咖讲解': print("该用户不是VIP用户") return False elif tvDesc == "VIP已到期": print("该用户VIP已到期") return False else: return True
def no_apply(self): self.driver.find_element_by_name('课堂').click() print("课程未报名,有试听章节,进入试听点击【下载】") Ads.test_ketang_ad(self) screen = swipe.get_size(self) self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 10000) list = self.driver.find_elements_by_id("com.mbalib.android.wiki:id/recycler_list") if not list: self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 10000) list = self.driver.find_elements_by_id("com.mbalib.android.wiki:id/recycler_list") list[0].find_elements_by_class_name("android.widget.LinearLayout")[0].click() sleep(5) isBuy=isElement.find_Element(self,'id','tv_buy') if isBuy: print("该课程未报名") #判断该课程是否有试听章节 course=isElement.find_Element(self,'id','tv_tab_title') if not course: self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 10000) self.driver.find_element_by_name('课程').click() sleep(3) isListen=isElement.find_Element(self,"id","tv_try_listen") if isListen: print("该课程有试听章节") self.driver.find_elements_by_id('com.mbalib.android.wiki:id/llparent')[0].find_elements_by_id("com.mbalib.android.wiki:id/recycler")[0].click() sleep(5) self.driver.find_element_by_id("imageDownload").click() sleep(3) #触发【报名后可下载课程】弹窗 popuWind=isElement.find_Element(self,'name','报名后可下载课程') if popuWind: print("触发【报名后可下载课程】弹窗") #点击【马上报名】 self.driver.find_element_by_id("tvSignUp").click() sleep(5) title=self.driver.find_element_by_id('toolbar_tv_title').text if title=='课程详情': print("点击【马上报名】返回到课程详情页,该测试用例成功") else: print("点击【马上报名】跳转不是返回到了课程详情页") else: print("未触发【报名后可下载课程】弹窗") else: print("该课程无试听章节") else: print("该课程已报名")
def test_praise(self): print("是否有好评弹窗") tvPraise = isElement.find_Element(self, 'id', 'tvPraise') sleep(5) if tvPraise: print("存在好评弹窗,点击【取消】") self.driver.find_element_by_id('tvCnacle').click() else: print("不存在好评弹窗")
def test_home_banner(self): print('首页横幅广告') #判断是否有首页横幅广告 hengfu = isElement.find_Element(self, 'id', 'iv_home_wiki') if hengfu: print('存在横幅广告') self.driver.find_element_by_id('iv_home_wiki').click() back.ivBack(self) else: print('不存在横幅广告')
def test_is_ad(self): driver = self.driver llparent = isElement.find_Element(self, 'id', 'image') sleep(5) print('判断是否有首页广告', llparent) if llparent: # 判断是否有首页广告 print('有首页广告') driver.find_element_by_id('image').click() sleep(5) isWeixin = isElement.find_Element(self, 'id', 'tv_popu_course_bind_wx_bind') if isWeixin: self.driver.find_element_by_id( 'tv_popu_course_bind_wx_cancel').click() #返回 back.ivBack(self) else: print("无首页广告") sleep(5)
def test_splash_tv_skip(self): # 判断是否有闪屏广告 print('判断是否有闪屏广告') splash = isElement.find_Element(self, 'id', 'splash_iv_image') if splash: print('有闪屏广告点击【跳过】') self.driver.find_element_by_id('splash_tv_skip').click() Ads.test_is_ad(self) else: print('test_splash_tv_skip无闪屏广告')
def test_noSkip(self): print('不点击跳过闪屏广告,倒计时结束') # 判断是否有闪屏广告 splash = isElement.find_Element(self, 'id', 'splash_iv_image') # 不点击闪屏广告或者跳过按钮,倒计时结束跳转到首页 if splash: print('有闪屏广告不做操作等倒计时') sleep(10) else: print('test_noSkip无闪屏广告')
def privacy_policy_agree(self): #判断是否有隐私政策弹窗 flag = isElement.find_Element(self, 'id', 'tv_app_privacy_right_title') if flag: #存在隐私政策弹窗 #点击同意 self.driver.find_element_by_id('tv_app_privacy_right_agree').click() sleep(5) else: print("不存在隐私政策弹窗")
def test_ask_tv_cancel(self): print('稍后安装用例') askTvTitle = isElement.find_Element(self, 'id', 'ask_tv_title') if askTvTitle: print("存在有更新版本弹窗") # 点击【稍后安装】 self.driver.find_element_by_id('ask_tv_cancel').click() else: print("不存在有更新版本弹窗") sleep(5)
def toPlay(self, isVip): print("从百科首页进入播放页") # 判断是否能看到【听讲解】列表 flag = isElement.find_Element(self, 'id', 'recycler_wiki_home_listen') while not flag: screen = swipe.get_size(self) self.driver.swipe(screen[0] * 0.5, screen[1] * 0.75, screen[0] * 0.5, screen[1] * 0.25, 6000) flag = isElement.find_Element(self, 'id', 'recycler_wiki_home_listen') sleep(5) list = self.driver.find_elements_by_id('recycler_wiki_home_listen')[ 0].find_elements_by_id('rl_item_wiki_home_all') sleep(5) try: sizes = len(list[0]) aduioVip = list[0].find_element_by_id('ivImageVip').is_displayed() except: aduioVip = False print("aduioVip:", aduioVip) list[0].click() sleep(5) if aduioVip: print("该音频是vip音频") if isVip: print("用户是vip,进入播放页") else: print("用户不是vip用户,触发开通弹窗") parentPanel = isElement.find_Element(self, 'id', 'parentPanel') if parentPanel: print("触发了开通提示弹窗") else: print("未触发") else: print("该音频不是vip音频,不管用户是否为vip都进入播放页") # 判断进入的是否为播放页 play = isElement.find_Element(self, 'id', 'rl_wiki_play_detail_top') if play: print("进入播放页") return True else: print("未进入播放页") return False
def play_list_off(self): print("播放列表") self.driver.find_element_by_id('tv_wiki_play_detail_play_list').click() sleep(5) flag = isElements.find_Element(self, 'id', 'recycler_popu_wiki_detail_list') if flag: print("播放列表弹窗") # 关闭播放列表 self.driver.find_element_by_id( 'tv_popu_wiki_play_detail_list_close').click() sleep(5) # 判断是否关闭了弹窗 play = isElements.find_Element(self, 'id', 'iv_wiki_play_detail_play') if play: print("关闭列表弹窗成功") else: print("未返回到播放页") else: print("未显示出播放列表弹窗")
def isLogin(self): print("判断用户是否登录") # 切换到我的 self.driver.find_element_by_name('我的').click() isLogin = isElements.find_Element(self, 'id', 'tv_my_fragment_login_no_login') if isLogin: print("用户未登录") return False else: return True