def test_search_po(self):
     datas = ExcelReader(self.excel).data
     for d in datas:
         with self.subTest(data=d):
             self.sub_setUp_po()
             self.page.search(d['search'])
             time.sleep(2)
             self.page = BaiDuResultPage(self.page)  #页面跳转到result页面
             self.page.save_screen_shot()
             links = self.page.result_links
             for link in links:
                 logger.info(link.text)
             self.sub_tearDown_po()
Esempio n. 2
0
 def test_search(self):
     datas = ExcelReader(self.excel).data
     for d in datas:
         with self.subTest(data=d):
             self.sub_setUp()
             self.driver.find_element(*self.locator_kw).send_keys(
                 d['search'])
             self.driver.find_element(*self.locator_su).click()
             time.sleep(2)
             links = self.driver.find_elements(*self.locator_result)
             for link in links:
                 logger.info(link.text)
             self.sub_tearDown()