def test_view_nba_news(self):

        homepage = HomePage(self.driver)
        homepage.click_news()

        news_homepage = NewsHomePage(self.driver)
        news_homepage.click_sports_news()
        time.sleep(2)

        news_homepage.get_windows_img()
示例#2
0
 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))
示例#3
0
 def test_view_nba_news(self):
     #初始化百度首页
     homepage = HomePage(self.driver)
     homepage.click_news()
     #初始化一个百度新闻主页对象
     newshome = BaiduNewsHomePage(self.driver)
     newshome.click_sports()
     sportnewhome = SprotsNewsHomePage(self.driver)
     sportnewhome.click_nba_link()
     time.sleep(2)
     sportnewhome.switch_to_new_handle()
     sportnewhome.get_windows_image()
     try:
         assert "NBA赛程表" in sportnewhome.get_page_title()
     except Exception as e:
         print('Test Fail.', format(e))
示例#4
0
 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_baidu_search(self):
     home_page=HomePage(self.driver)
     home_page.search('selenium')
示例#6
0
 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))
示例#7
0
 def test_get_baidu_tittle(self):
     homepage = HomePage(self.driver)
     tittle = homepage.get_page_title()
     assert tittle.startswith('百度一下')