Пример #1
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)
Пример #2
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
Пример #3
0
 def setUp(self):
     self.driver = choose('firefox')