Esempio n. 1
0
    def test_3getdata(cls):
        '''跳转到报表查询界面,获取页面数据'''
        driver = cls.driver
        test = BaseAction(driver)
        # 点击条件选择
        test.Click("xpath",
                   "//*[@id='comptrollerData_searchHeader']//td[1]/span[2]")
        test.Wait(1)
        # 输入要查询的用户
        test.Input("id", "userName", "baoyong123")
        # 点击开始时间控件
        test.Click("xpath", "//*[@id='dataStartTime']")
        test.Wait(1)
        # 执行js,使时间控件可读
        js = 'document.getElementById("dataStartTime").removeAttribute("readonly")'
        js1 = 'document.getElementById("dataEndTime").removeAttribute("readonly")'
        test.Excecute_Script(js)
        test.Excecute_Script(js1)
        # 输入查询开始和结束时间
        test.Input("id", "dataStartTime", t_date2)
        # 点击结束时间控件
        test.Click("xpath", "//*[@id='dataEndTime']")
        test.Input("id", "dataEndTime", t_date1)

        # js_begin = 'document.getElementById("dataStartTime").value="2018-08-20"'
        # js_end = 'document.getElementById("dataEndTime").value="2018-08-27"'
        # test.Excecute_Script(js_begin)
        # test.Excecute_Script(js_end)
        test.Click("id", "comptrollerData_submit")
        log.info("提交")
        test.Wait(3)
        cls.switch_page()
Esempio n. 2
0
 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()