def test_zc_dh_help_close(self): """ 鼠标滑过“帮你租房” :return: """ f = False rlpage = RentListPage(self.driver) rlpage.show_help_rent() try: assert u"365租房助手" in rlpage.fine_element(rlpage.zc_show_help_pic).text print ('Show PIC Test Pass.') f = True except Exception as e: print ('Test Fail.', format(e)) raise e if f == True: rlpage.click_help_pic() rlpage.switch_widows() # 切换到新打开的tab,去check打开的页面正确与否 try: assert u"南京出租房" in rlpage.get_page_title() print ('Open PIC Test Pass.') rlpage.switch_widows(isclose=True) # 切 换回原来的tab, 并关闭原来的tab except Exception as e: print('Test Fail.', format(e)) rlpage.switch_widows(isclose=True) # 切 换回原来的tab, 并关闭原来的tab raise e rlpage.close_help_pic() rlpage.sleep(2)
def test_click_personal_tab(self): """ 点击“个人房源” :return: """ rlpage = RentListPage(self.driver) rlpage.click_personal_tab() try: assert u"个人" in rlpage.fine_element(rlpage.search_key) print ('Test Pass.') except Exception as e: print ('Test Fail.', format(e)) raise e
def test_search_community(self): """ 搜索,关键词为“小区” :return: """ rlpage = RentListPage(self.driver) rlpage.send_community(u"凤凰和美") rlpage.sleep(10) rlpage.click_search_btn() rlpage.sleep(10) try: assert rlpage.fine_element(rlpage.search_key) print ('Test Pass.') except Exception as e: print ('Test Fail.', format(e)) raise e