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_search2(self): homepage = HomePage(self.driver) homepage.type_search('python') homepage.send_submit_btn() time.sleep(2) homepage.get_windows_img() try: assert 'python' in homepage.get_page_title() print ('Test pass.') 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))
def test_get_baidu_tittle(self): homepage = HomePage(self.driver) tittle = homepage.get_page_title() assert tittle.startswith('百度一下')