def test_baidu_serach_python(self): homepage = HomePage(self.driver) homepage.input_search_text("python") homepage.click_submit_btn() homepage.sleep(2) homepage.get_windows_image() try: assert "python" in homepage.get_page_title() except Exception as e: print('Test Fail.', format(e))
def test_baidu_search(self): """ 这里一定要test开头,把测试逻辑代码封装到一个test开头的方法里。 :return: """ homepage = HomePage(self.driver) homepage.input_search_text("selenium") homepage.click_submit_btn() homepage.sleep(2) try: assert 'selenium' in homepage.get_page_title() except Exception as e: print('Test Fail.', format(e))