def test_search_order_by_area(self):
     hp = HomePage(self.driver)
     sleep(1)
     hp.click(hp.order_qurey_locator)
     sleep(1)
     # 切换到main-frame
     bp = BasePage(self.driver)
     bp.switch_main_frame()
     sleep(1)
     # 选择地区
     oqp = OrderQueryPage(self.driver)
     hp.select(oqp.coutry_select_locator).select_by_index(1)
     sleep(1)
     hp.select(oqp.province_select_locator).select_by_index(1)
     sleep(1)
     hp.select(oqp.city_select_locator).select_by_index(1)
     sleep(1)
     hp.select(oqp.district_select_locator).select_by_index(1)
     sleep(1)
     # 点击搜索
     hp.click(oqp.click_search_locator)
     sleep(1)
     #断言
     hp.click(self.lookover_locator)
     sleep(1)
     text = hp.text(self.assert_adress_locator)
     self.assertIn(self.assert_adress, text)
 def test_search_order_by_consignee_query(self):
     hp = HomePage(self.driver)
     sleep(1)
     hp.click(hp.order_qurey_locator)
     sleep(1)
     # 切换到main-frame
     bp = BasePage(self.driver)
     bp.switch_main_frame()
     sleep(1)
     # 输入收货人
     oqp = OrderQueryPage(self.driver)
     hp.send_keys(oqp.input_consignee_locator, self.consignee_name)
     # 点击搜索
     hp.click(oqp.click_search_locator)
     sleep(1)
     #断言
     op = OrderListPage(self.driver)
     text = hp.text(op.consignee_locator)
     self.assertIn(self.consignee_name, text)
 def test_search_order_by_adress(self):
     hp = HomePage(self.driver)
     sleep(1)
     hp.click(hp.order_qurey_locator)
     sleep(1)
     # 切换到main-frame
     bp = BasePage(self.driver)
     bp.switch_main_frame()
     sleep(1)
     # 输入地址
     oqp = OrderQueryPage(self.driver)
     hp.send_keys(oqp.input_adress_locator, self.adress_assert)
     # 点击搜索
     hp.click(oqp.click_search_locator)
     sleep(1)
     #断言
     op = OrderListPage(self.driver)
     text = hp.text(op.adress_locator)
     self.assertIn(self.adress_assert, text)
 def test_search_order_by_phonenumber(self):
     # 进入到订单页面
     hp = HomePage(self.driver)
     sleep(1)
     hp.click(hp.order_qurey_locator)
     sleep(1)
     # 切换到main-frame
     bp = BasePage(self.driver)
     bp.switch_main_frame()
     sleep(1)
     # 输入收手机号码
     oqp = OrderQueryPage(self.driver)
     hp.send_keys(oqp.input_phonenumber_locator, self.phonenumber)
     # 点击搜索
     hp.click(oqp.click_search_locator)
     sleep(1)
     #断言
     op = OrderListPage(self.driver)
     text = hp.text(op.phonenumber_locator)
     self.assertIn(self.phonenumber, text)
Beispiel #5
0
 def test_print_order(self):
     #进入订单页面
     hp = HomePage(self.driver)
     sleep(1)
     hp.click(hp.orderlist_locator)
     sleep(1)
     #切换到main-frame
     bp = BasePage(self.driver)
     bp.switch_main_frame()
     sleep(1)
     #选中订单
     op = OrderListPage(self.driver)
     op.click(op.click_order_locator)
     sleep(1)
     #点击打印订单
     op.click(op.print_locator)
     sleep(1)
     #切换到新开窗口订单打印界面
     bp.switch_window()
     #断言
     pp = PrintPage(self.driver)
     text = bp.text(pp.printorder_word_locator)
     self.assertEqual(self.assert_word, text)
 def test_search_order_by_consignee(self):
     #进入到订单页面
     hp = HomePage(self.driver)
     sleep(1)
     hp.click(hp.orderlist_locator)
     sleep(1)
     # 切换到main-frame
     bp = BasePage(self.driver)
     bp.switch_main_frame()
     sleep(1)
     #输入收货人
     op = OrderListPage(self.driver)
     op.send_keys(op.input_consignee_locator, self.consignee_name)
     #订单状态选择最上面一项
     select = op.select(op.select_status_locator)
     select.select_by_value('-1')
     sleep(1)
     #点击搜索
     op.click(op.search_locator)
     sleep(1)
     #断言
     get_consignee_name = op.text(op.consignee_locator)
     self.assertEqual(self.consignee_name, get_consignee_name)
Beispiel #7
0
 def test_delete_case_cancelself(self):
     #进入订单页面
     hp = HomePage(self.driver)
     sleep(1)
     hp.click_orderlist()
     sleep(1)
     #切换到main-frame
     bp = BasePage(self.driver)
     bp.switch_main_frame()
     sleep(1)
     #选中订单
     op = OrderListPage(self.driver)
     op.click(op.click_order_locator)
     get_order_number = op.text(op.order_number_locator)
     #点击删除
     op.click(op.delete_locator)
     sleep(1)
     #弹出框点击确认删除
     self.driver.switch_to.alert.dismiss()
     sleep(4)
     get_order_number1 = op.text(op.order_number_locator)
     #断言
     self.assertEqual(get_order_number, get_order_number1)
Beispiel #8
0
# current_handle = driver.current_window_handle
# print(handles)
# print(current_handle)
# driver.switch_to.window(handles[1])
# sleep(2)
# driver.close()
# driver.switch_to.window(current_handle)
# sleep(2)

hp = HomePage(driver)
sleep(1)
hp.click_order_query()
sleep(1)
# 切换到main-frame
bp = BasePage(driver)
bp.switch_main_frame()
sleep(1)
# 输入收货人
op = OrderQueryPage(driver)
op.input_consignee('dtt')
# 点击搜索
tbody_locator = (By.XPATH, '/html/body/div[1]/form/table/tbody')
tbody = bp.find_element(tbody_locator)
tr2 = tbody.find_elements(By.TAG_NAME, 'tr')[9]
td2 = tr2.find_elements(By.TAG_NAME, 'td')[0]
input = td2.find_elements(By.TAG_NAME, 'input')[0]
input.click()
sleep(2)
# 断言
bp.switch_menu_frame()
bp.switch_main_frame()