def test_3select(cls): '''选择查询车辆和时间''' driver = cls.driver test = BaseAction(driver) # 点击搜索框 test.Click("xpath", "//*[@id='oil_radio_tree_content']/div[1]/input") # 输入要查询的车辆车牌号信息 test.Input("xpath", "//*[@id='oil_radio_tree_content']/div[1]/input", "济宁00001") # 点击查询按钮 test.Click("xpath", "//*[@id='oil_radio_tree_content']/div[1]/a") test.Wait(3) # 选中要查询的车辆 test.Click("xpath", "//*[@class='checkboxcontent']/span[@id='20180131171228000000000000008188-jquery-extend-ui-radio']/span[2]") # 点击返回框 test.wait(3) test.Click("xpath", "//*[@id='oil_radio_tree_content']/div[4]") # 点击下一步 test.wait(2) test.Click("xpath", "//*[@id='tyre_next_setting']") report_name = test.Get_text("xpath", "//*[@id='rnavigation']/li[2]/span[2]") try: cls.assertEqual(report_name, '单车行驶里程及油耗报表') log.info("跳转到单车行驶里程及油耗报表查询界面") except AssertionError as e: test.get_windows_img('单车行驶里程及油耗报表') print("找不到报表标题:", report_name) raise test.scrollLow("id", "turnPageButton") # 滑动到页面底部 test.Wait(2) cls.switch_page()
def test_4getdata(cls): '''跳转到报表查询界面,获取页面数据''' driver = cls.driver test = BaseAction(driver) test.Click("id", "gps_toolbar_leftbutton_div_w") test.Click("id", "gps_main_menu_report_s_p") test.wait(5) test.Click("id", "id202694") test.wait(5) cls.switch_page()
def test_2skip(cls): '''跳转到报表查询界面''' driver = cls.driver test = BaseAction(driver) test.Click("id", "gps_toolbar_leftbutton_div_w") # 点击报表查询按钮 test.Click("id", "gps_main_menu_report_s_p") test.wait(5) # 点击单车里程油耗报表按钮 test.Click("id", "id401010") test.wait(5)
def test_2skip(cls): '''跳转到报表查询界面''' driver = cls.driver test = BaseAction(driver) test.Click("id", "gps_toolbar_leftbutton_div_w") test.Click("id", "gps_main_menu_report_s_p") test.wait(5) test.Click("id", "id201414") test.wait(5) report_name = test.Get_text("xpath", "//*[@id='rnavigation']/li[2]/span[2]") try: cls.assertEqual(report_name, '车辆行驶里程及油耗报表') log.info("跳转到车辆里程油耗报表查询界面") except AssertionError as e: test.get_windows_img('车辆里程油耗报表跳转') print("找不到报表标题:", report_name) raise
def test_2skip(cls): '''跳转到报表查询界面''' driver = cls.driver test = BaseAction(driver) test.Click("id", "gps_toolbar_leftbutton_div_w") test.Click("id", "gps_main_menu_report_s_p") test.wait(5) test.Click("id", "id401013") test.wait(5) test.get_windows_img('查岗报表跳转成功') report_name = test.Get_text("xpath", "//*[@class='main_table']//li[2]/span[2]") try: cls.assertEqual(report_name, '平台查岗报表') log.info("跳转到查岗报表查询界面") except AssertionError as e: print("找不到报表标题:", report_name) raise
def test_5Yestoday(cls): '''查询昨日数据''' driver = cls.driver test = BaseAction(driver) # test.Click("xpath","//*[@id='warnData_searchHeader']/table/tbody/tr/td[1]") test.Click("id", "EasierUI_SELECT_warnData_container2") test.Click("xpath", "//*[@title='昨天']") test.Click("id", "staticData_submit") test.wait(5) log.info("查询昨天数据") cls.switch_page() log.info("验证数据") excel = "F:\\PyTesting\\AutoTest\\log\\excel\\History_TARG.xls" excel1 = "F:\\PyTesting\\AutoTest\\log\\excel\\History_Yes_DB.xlsx" try: cls.assertTrue(test_read_excel(0, excel, excel1, "Yes_Result.xlsx")) print("数据查询成功!") except AssertionError as e: log.info("数据查询失败,页面数据和系统数据不一致!") raise
def test_6last_month(cls): '''查询系统上月数据''' driver = cls.driver test = BaseAction(driver) # test.Click("xpath", "//*[@id='platCheck_searchHeader']//td[1]/span[2]/span") test.Click("id", "EasierUI_SELECT_platCheck_container1") test.Click("xpath", "//*[@id='EasierUI_SELECT_platCheck_container1']//li[5]") test.Click("id", "platCheck_submit") log.info("查询上月数据") test.wait(5) cls.switch_page() log.info("验证数据") excel = "F:\\PyTesting\\AutoTest\\log\\excel\\Plat_Query.xls" excel1 = "F:\\PyTesting\\AutoTest\\log\\excel\\Plat_L_DB.xlsx" try: cls.assertTrue( test_read_excel(3, excel, excel1, "Plat_L_Result.xlsx")) log.info("数据查询成功!") except AssertionError as e: log.info("数据查询失败,页面数据和系统数据不一致!") raise test.wait(10)