Exemplo n.º 1
0
 def test_something(self):
     driver = self.driver
     start(driver)
     click_list = ['功率曲线展示', '历史曲线']
     # click_list=['功率曲线展示','预测曲线','短期预测曲线']
     for i in click_list:
         driver.find_element_by_link_text(i).click()
     driver.find_element_by_id('beginDate').click()
     js = "$('input[id=beginDate]').attr('readonly','')"
     driver.execute_script(js)
     driver.find_element_by_id('beginDate').clear()
     driver.find_element_by_id('beginDate').send_keys(
         '2017-06-24')  # 输入查询开始时间
     # time.sleep(2)
     driver.find_element_by_id('endDate').click()
     js = "$('input[id=endDate]').attr('readonly','')"
     driver.execute_script(js)
     driver.find_element_by_id('endDate').clear()
     driver.find_element_by_id('endDate').send_keys(
         '2017-06-25')  # 输入查询结束时间
     # time.sleep(2)
     driver.find_element_by_id('search').click()
     time.sleep(2)
     hang = '/html/body/div/div[2]/div[2]/div[2]/div[2]/div[2]/table/tbody/tr'
     lie = hang + '[1]/td'
     tr = driver.find_elements_by_xpath(hang)  # 288 行数
     td = driver.find_elements_by_xpath(lie)  # 7 列数
     print(len(tr), len(td))
     list_henchu = []  # 获取横向列表
     for i in range(1, len(tr) + 1):
         for k in range(1, len(td) + 1):
             m = hang + '[' + str(i) + ']' + '/td[' + str(k) + ']'
             try:
                 list_henchu.append(
                     float(driver.find_element_by_xpath(m).text))
             except:
                 list_henchu.append(driver.find_element_by_xpath(m).text)
     print("list横向初始值是:", list_henchu)
     list_qie = [0]
     list_henzhong = []
     for i in range(1, len(tr) + 1):
         list_qie.append(len(td) * i)
     for i in list_qie:
         list_henzhong.append(list_henchu[i:i + len(td)])
     list_henzhong.pop()
     print("横向最终值", list_henzhong)
     print('第一,三列值', get_col(list_henzhong, 3))
     print('去除空格', deltup(get_col(list_henzhong, 3), ' '))
Exemplo n.º 2
0
    def test_1_sjgl(self):
        '''功率曲线展示 > 短期上报曲线 > 实际功率'''
        driver = self.driver
        driver.maximize_window()
        start(
            driver,
            'http://192.168.60.21:8080/SPPS/weatherInfo/temCurveAction.action')
        if now_time()[0] != 1:
            print("waiting 70")
            time.sleep(70)
        click_list = ['功率曲线展示', '上报曲线']  #点击菜单
        menu(driver, click_list)
        driver.find_element_by_id('search').click()  #搜索
        time.sleep(2)
        hang = '/html/body/div/div[2]/div[2]/div[2]/div[2]/div[2]/table/tbody/tr'
        global list_heng
        list_heng = get_heng(driver, hang)  #获取表格数据
        list_sjgl_yuan = get_col(list_heng, 3).copy()  # 将表格数据生成列表
        list_sjgl = del_list_tup(list_sjgl_yuan, ' ')
        if list_sjgl == []:
            print("列表查询数据为空,无法比较")
        else:
            sql_kk = "SELECT a.GATHER_DATE,a.GATHER_TIME,a.POWER_VALUE FROM GF_SPPS_POWER_HIS a \
WHERE a.GATHER_DATE='now_date()' ORDER BY a.GATHER_TIME asc"

            sql = sql_kk.replace("now_date()", now_date())
            list_sql = get_oracle_h(sql, 2)  # 查询数据库
            print('实际功率表格数据为:', list_sjgl)
            print('实际功率sql数据为', list_sql)
            print('\n')
            self.assertEqual(list_sjgl, list_sql)
Exemplo n.º 3
0
 def test_1_tianqi(self):
     '''气象信息展示 > 温度曲线 >天气预报'''
     self.driver = choose('firefox')
     driver = self.driver
     driver.maximize_window()
     start(
         driver,
         'http://192.168.60.36:8080/SPPS/weatherInfo/temCurveAction.action')
     click_list = ['气象信息展示', '温度曲线']  #点击菜单
     menu(driver, click_list)
     set_date(driver)
     driver.find_element_by_id('search').click()  #搜索
     time.sleep(2)
     hang = '/html/body/div/div[2]/div[2]/div[2]/div[2]/div[2]/table/tbody/tr'
     global list_heng
     list_heng = get_heng(driver, hang)  #获取表格数据
     list_wen_yuan = get_col(list_heng, 3).copy()  #将表格数据生成列表
     list_wen = del_list_tup(list_wen_yuan, ' ')
     if list_wen == []:
         print("列表查询数据为空,无法比较")
     else:
         list_wen.pop()
         list_sql = get_oracle_h('192.168.60.36',
                                 "SELECT a.PRE_DATE,a.PRE_TIME,a.ARI_TEM \
         FROM GF_SPPS_NWP_DEAL a WHERE PRE_DATE='2017-09-06' ORDER BY PRE_TIME asc",
                                 2)  #查询数据库
         print('表格数据为:', list_wen)
         print('sql查询值为', list_sql)
         print('\n')
         self.assertEqual(list_wen, list_sql)
Exemplo n.º 4
0
 def test_1_ycgl(self):
     '''功率曲线展示 > 预测曲线 > 超短期预测曲线 > 预测功率'''
     driver = self.driver
     driver.maximize_window()
     start(
         driver,
         'http://192.168.60.21:8080/SPPS/weatherInfo/temCurveAction.action')
     click_list = ['功率曲线展示', '预测曲线', '超短期预测曲线']  #点击菜单
     menu(driver, click_list)
     if now_time()[0] != 1:
         print("waiting 70")
         time.sleep(70)
     driver.find_element_by_id('search').click()  #搜索
     time.sleep(2)
     hang = '/html/body/div/div[2]/div[2]/div[2]/div[2]/div[2]/table/tbody/tr'
     global list_heng
     list_heng = get_heng(driver, hang)  #获取表格数据
     list_ycgl_yuan = get_col(list_heng, 3).copy()  # 将表格数据生成列表
     list_ycgl = del_list_tup(list_ycgl_yuan, ' ')
     if list_ycgl == []:
         print("列表查询数据为空,无法比较")
     else:
         sql_kk = "SELECT a.PRE_DATE, a.PRE_TIME, a.PRE_POWER FROM SPPS_PREDICT_CDQ_DEAL a WHERE " \
                  "PRE_DATE = 'tom_date()' and a.pre_date || ' ' || a.pre_time >to_char(sysdate - 0 / 24, 'yyyy-mm-dd hh24:mi:ss') ORDER BY PRE_TIME "
         sql = sql_kk.replace("tom_date()", now_date())
         list_sql = get_oracle_h(sql, 2)  # 查询数据库
         print('超短期预测表格数据为:', list_ycgl)
         print('超短期预测sql数据为', list_sql)
         print('\n')
         self.assertEqual(list_ycgl, list_sql)
Exemplo n.º 5
0
    def test_3_ycgl_two(self):
        '''功率曲线展示 > 预测曲线 > 短期预测曲线 > 预测功率 >两天'''
        driver = self.driver
        driver.maximize_window()
        start(
            driver,
            'http://192.168.60.21:8080/SPPS/weatherInfo/temCurveAction.action')
        click_list = ['功率曲线展示', '预测曲线', '短期预测曲线']  # 点击菜单
        menu(driver, click_list)
        if now_time()[0] != 1:
            print("waiting 70")
            time.sleep(70)
        set_date(driver, tom_date(), hou_date())
        driver.find_element_by_id('search').click()  # 搜索
        time.sleep(2)
        hang = '/html/body/div/div[2]/div[2]/div[2]/div[2]/div[2]/table/tbody/tr'
        global list_heng
        list_heng = get_heng(driver, hang)  # 获取表格数据
        list_ycgl_yuan = get_col(list_heng, 3).copy()  # 将表格数据生成列表
        list_ycgl = del_list_tup(list_ycgl_yuan, ' ')
        if list_ycgl == []:
            print("列表查询数据为空,无法比较")
        else:
            sql_kk = "SELECT a.PRE_DATE,a.PRE_TIME,a.PRE_POWER \
FROM GF_SPPS_PREDICT_NWP_DEAL a WHERE a.PRE_DATE in ('tom_date()','hou_date()') ORDER BY a.PRE_DATE,a.PRE_TIME asc "

            sql = sql_kk.replace("tom_date()", tom_date())
            sql = sql.replace("hou_date()", hou_date())
            print(sql)
            list_sql = get_oracle_h(sql, 2)  # 查询数据库
            print('预测功率表格数据为:', list_ycgl)
            print('预测功率sql数据为', list_sql)
            print('\n')
            self.assertEqual(list_ycgl, list_sql)
Exemplo n.º 6
0
 def test_2_shiche(self):
     '''气象信息展示 > 温度曲线 >实测监测温度'''
     list_shiche_yuan=get_col(list_heng,4)
     list_shiche=del_list_tup(list_shiche_yuan,' ')
     if list_shiche==[]:
         print("列表查询数据为空,无法比较")
     else:
         list_shiche_sql=get_mysql_h('192.168.60.167',"SELECT a.COLLECTION_DATE,a.COLLECTION_TIME,a.ARI_TEM \
         FROM SPPS_FZYI_MON_HIS a WHERE a.COLLECTION_DATE='2017-09-06' ORDER BY a.COLLECTION_TIME",2)
         print('实测监测温度表格数据为:',list_shiche)
         print('实测监测温度sql查询值为',list_shiche_sql)
         print('\n')
         self.assertEqual(list_shiche,list_shiche_sql)
Exemplo n.º 7
0
    def test_5_4h(self):
        '''功率曲线展示 > 短期上报曲线 > 4h预测功率'''
        list_4h_yuan = get_col(list_heng, 7)
        list_4h = del_list_tup(list_4h_yuan, ' ')
        if list_4h == []:
            print("列表查询数据为空,无法比较")
        else:
            sql_kk = "SELECT a.PRE_DATE,a.PRE_TIME,a.PRE_POWER \
FROM SPPS_PREDICT_CDQ_HIS a WHERE POINT='240' AND PRE_DATE='now_date()'  ORDER BY PRE_TIME asc"
            sql = sql_kk.replace("now_date()", now_date())
            list_4h_sql = get_oracle_h(sql, 2)
            print('4h理论功率表格数据为:', list_4h)
            print('4h理论功率sql数据为', list_4h_sql)
            print('\n')
            self.assertEqual(list_4h, list_4h_sql)
Exemplo n.º 8
0
    def test_2_llgl(self):
        '''功率曲线展示 > 短期上报曲线 > 理论功率'''
        list_llgl_yuan = get_col(list_heng, 4)
        list_llgl = del_list_tup(list_llgl_yuan, ' ')
        if list_llgl == []:
            print("列表查询数据为空,无法比较")
        else:
            sql_kk = "SELECT a.FOCA_DATE,a.FOCA_TIME,a.THEORY_NUM FROM GF_SPPS_PROD_THEORY a \
WHERE a.FOCA_DATE='now_date()' and mod(to_char(to_date(a.foca_time,'HH24:mi:ss'),'mi'),15)=0 ORDER BY a.FOCA_TIME asc"
            sql = sql_kk.replace("now_date()", now_date())
            list_llgl_sql = get_oracle_h(sql, 2)
            print('理论功率表格数据为:', list_llgl)
            print('理论功率sql数据为', list_llgl_sql)
            print('\n')
            self.assertEqual(list_llgl, list_llgl_sql)
Exemplo n.º 9
0
    def test_2_sbgl(self):
        '''功率曲线展示 > 预测曲线 > 短期预测曲线 >上报功率'''
        list_sbgl_yuan = get_col(list_heng, 4)
        list_sbgl = del_list_tup(list_sbgl_yuan, ' ')
        if list_sbgl == []:
            print("列表查询数据为空,无法比较")
        else:
            sql_kk = "SELECT a.PRE_DATE,a.PRE_TIME,a.CORRECT_POWER \
FROM GF_SPPS_PREDICT_NWP_DEAL a WHERE PRE_DATE='tom_date()' ORDER BY PRE_TIME asc "

            sql = sql_kk.replace("tom_date()", tom_date())
            list_sbgl_sql = get_oracle_h(sql, 2)
            print('上报功率表格数据为:', list_sbgl)
            print('上报功率sql数据为', list_sbgl_sql)
            print('\n')
            self.assertEqual(list_sbgl, list_sbgl_sql)
Exemplo n.º 10
0
    def test_9_1h(self):
        '''功率曲线展示 > 短期上报曲线 > 1h预测功率>2天'''
        list_1h_yuan = get_col(list_heng, 6)
        list_1h = del_list_tup(list_1h_yuan, ' ')
        if list_1h == []:
            print("列表查询数据为空,无法比较")
        else:
            sql_kk = "SELECT a.PRE_DATE,a.PRE_TIME,a.PRE_POWER \
FROM SPPS_PREDICT_CDQ_HIS a WHERE POINT='60' AND PRE_DATE in ('yes_date()','now_date()') ORDER BY a.PRE_DATE,a.PRE_TIME asc"
            sql = sql_kk.replace("now_date()", now_date())
            sql = sql.replace("yes_date()", yes_date())
            list_1h_sql = get_oracle_h(sql, 2)
            print('1h理论功率表格数据为:', list_1h)
            print('1h理论功率sql数据为', list_1h_sql)
            print('\n')
            self.assertEqual(list_1h, list_1h_sql)
Exemplo n.º 11
0
def gf_liuchen(click_list, datelist,
               its_xpath):  #浏览器,菜单列表,是否点日历,日历列表,xpath,数据库列表
    driver = choose("firefox")
    driver.maximize_window()
    start(driver)
    # click_list = ['气象信息展示', '温度曲线'] #点击菜单
    menu(driver, click_list)
    if datelist[0] == 1:
        set_date(driver, datelist[1], datelist[2])
    else:
        pass
    driver.find_element_by_id('search').click()  #搜索
    time.sleep(2)
    hang = its_xpath
    # hang='/html/body/div/div[2]/div[2]/div[2]/div[2]/div[2]/table/tbody/tr'
    list_heng = get_heng(driver, hang).copy()  #获取表格数据
    list_wen = get_col(list_heng, n).copy()  #将表格数据生成列表
    # list_sql=get_oracle_h('192.168.60.36',"SELECT a.PRE_DATE,a.PRE_TIME,a.ARI_TEM \
    # FROM GF_SPPS_NWP_DEAL a WHERE PRE_DATE='2017-08-08' ORDER BY PRE_TIME asc", 2)#查询数据库
    list_sql = get_oracle_h(list_oracle[0], list_oracle[1], list_oracle[2])
    print(list_wen)
    print(list_sql)
    list_wen.pop()
    return list_wen, list_sql, driver
Exemplo n.º 12
0
driver.maximize_window()
driver.get("http://192.168.150.70:8080/Eeeweb/")
driver.find_element_by_id("username").send_keys("admin")
driver.find_element_by_id("password").send_keys("drhnyczzgood123")
driver.find_element_by_class_name("emailCode").send_keys("1")
driver.find_element_by_xpath(
    "/html/body/div[1]/div[1]/div/div[1]/dl/dd[4]/input").click()
time.sleep(3)
driver.get(
    "http://192.168.150.70:8080/Eeeweb/E3/index.html#/jdgf_scgl_znyc_ycpc")
time.sleep(3)
driver.find_element_by_partial_link_text('日均准确率').click()
driver.implicitly_wait(3)
try:
    list_heng = get_table(
        driver,
        xpath_page='//*[@id="day"]/div/div[2]/div[4]/ul/li[2]/span',
        xpath_table='//*[@id="day"]/div/div[2]/div[3]/table/tbody/tr')
    list_wen_yuan = get_col(list_heng, 4).copy()
    print(list_wen_yuan)

    # driver.find_element_by_xpath("//input[@values='beginDate']").click()
    # js = "$('input[values=beginDate]').removeAttr('readonly')"
    # driver.execute_script(js)
    # driver.find_element_by_xpath("//input[@values='beginDate']").clear()
    # driver.find_element_by_xpath("//input[@values='beginDate']").send_keys("2017-10-10")  # 输入查询开始时间

#     time.sleep(2)
finally:
    driver.close()