def get_api_车次详情根据车次号(self): '''# 调用了获取列车详情接口 :return: 字典 字段"endDate" 字段为到达时间 ,字段"arr_station"为途径站点列表 ''' 返回结果 = {} 回返途径站点 = [] 车次号 = self.get_选择车次出发和到达_车次号() path = '/vega-station/schedule/detailByTrainNo' form_datas = {"date": get_当前年月日(), "trainNO": str(车次号)} r = get_requests(path, form_datas=form_datas) 返回结果['endDate'] = r['endDate'] for i in range(len(r['data'])): for j in r['data'][i]: 回返途径站点.append(j['station_name']) 返回结果['arr_station'] = 回返途径站点 return 返回结果
self.act_上滑(4) self.click_点击(loc_text(终到站), "点击起点站点" + 终到站) self.click_选择车次出发和到达_跨天第一个() @allure.step(title='选择起始站') def btn_选择起始站(self, text): btn_起始站 = loc_text(text) return self.click_点击(btn_起始站, "点击起始站") @allure.step(title='选择终点站') def btn_选择终点站(self, text): return self.click_loc_with_scroll(text) # return self.click_点击(btn_终点站, "点击终点站") if __name__ == '__main__': # form_datas={"date":"2019-08-27","trainNO":"G74"} # r = get_requests('/vega-station/schedule/detailByTrainNo',form_datas=form_datas) # print(r['data'][0]) 返回结果 = {} 回返途径站点 = [] path = '/vega-station/schedule/detailByTrainNo' form_datas = {"date": get_当前年月日(), "trainNO": str("T289")} r = get_requests(path, form_datas=form_datas) 返回结果['endDate'] = r['endDate'] for i in range(len(r['data'])): for j in r['data'][i]: 回返途径站点.append(j['station_name']) 返回结果['arrive_time'] = 回返途径站点 print(返回结果)