def setUpClass(cls): cls.data = read_excel(project_path() + 'Data/testdata.xlsx', 0) cls.driver = webdriver.Chrome() cls.driver.get(config_url()) cls.driver.maximize_window() cls.log = FrameLog() cls.logger = cls.log.get_log()
def test_baidu(self): """ 携 程 订 票 测 试 用 例 test_baidu """ self.driver.get(config_url("baidu_url")) search_page = BaiduPage(self.driver) res_url = search_page.search_func("selenium") time.sleep(2) self.assertIn("wd=selenium", res_url)
def test_demo_02(self): """ demo 测 试 用 例 test_demo_02 """ self.driver.get(config_url("baidu_url")) self.driver.find_element_by_id("kw").send_keys("test_demo_02") self.driver.find_element_by_id("su").click() time.sleep(2) self.assertIn('1', "2")
def test_01(self): """ 携 程 订 票 测 试 用 例 test_01 """ self.driver.get(config_url("baidu_url")) self.driver.find_element_by_id("kw").send_keys("test_01") self.driver.find_element_by_id("su").click() time.sleep(2) self.assertIn('1', "3")
def test_search_train(self): self.driver.get(config_url()) search = SearchPage(self.driver) res = search.search_train( self.data.get(1)[1], self.data.get(1)[0], self.driver) # 本例断言是根据当前页面的URL来判断的 self.assertIn('trainBooking', res)
def test_ctrip(self): """ 携 程 订 票 测 试 用 例 test_ctrip """ self.driver.get(config_url("ctrip_url")) search_page = SearchPage(self.driver) res_url = search_page.search_train( self.data.get(1)[0], self.data.get(1)[1], self.data.get(1)[2]) # print(res_url) # 断言:返回的url中是否包含'TrainBooking' time.sleep(3) self.assertIn('TrainBooking', res_url)
def setUpClass(cls): cls.driver = webdriver.Chrome() cls.driver.get(config_url()) cls.driver.maximize_window()
def setUpClass(cls): ChromeDriverServer = '../driver/chromedriver' cls.driver = webdriver.Chrome(ChromeDriverServer) cls.driver.get(config_url()) cls.driver.maximize_window()
def open_base_url(self): self.driver.get(config_url()) self.driver.maximize_window()
def setUpClass(cls) -> None: cls.data = read_excel(project_path() + "Data/testData.xlsx", 0) cls.driver = webdriver.Chrome() cls.driver.get(config_url()) cls.driver.maximize_window()