1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > uibot进行携程航班信息查询

uibot进行携程航班信息查询

时间:2022-10-14 22:51:17

相关推荐

uibot进行携程航班信息查询

uibot进行携程航班信息查询

// 打开携程网站hWeb = WebBrowser.Create("chrome","/",30000,{"bContinueOnError":False,"iDelayAfter":300,"iDelayBefore":200,"sBrowserPath":"","sStartArgs":""})// 鼠标移动到机票按钮#icon("@res:djv3tseo-b9u9-6mcm-f78t-o38oc56phec7.png")Mouse.Hover({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"A","id":"nav_flight"}]},10000,{"bContinueOnError":False,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False})// s鼠标点击国内/国际·中国港澳台机票#icon("@res:s4bgs4ea-es9l-lt2j-f1ia-1g8jkl9r8pov.png")Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"A","id":"c_flights_f"}]},"left","click",10000,{"bContinueOnError":False,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False})#icon("@res:gcn8aiuq-abda-ffqt-q7v1-5br64e3gt5kb.png")// 设置出发地UiElement.SetValue({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"INPUT","name":"owDCity","parentid":"searchForm"}]},"长沙",{"bContinueOnError":False,"iDelayAfter":300,"iDelayBefore":200})#icon("@res:vh1d00h1-0iub-01bl-kk5i-rhvvtjcscait.png")// 设置目的地UiElement.SetValue({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"INPUT","name":"owACity"}]},"北京",{"bContinueOnError":False,"iDelayAfter":300,"iDelayBefore":200})dTime = Time.Now()TracePrint(dTime)// 获取明天的时间iRet = Time.DateAdd("d",1,dTime)sRet = Time.Format(iRet,"yyyy-mm-dd")#icon("@res:nhghebij-m7j4-0507-cejm-bkqlnriqqqhe.png")js = "function(){document.querySelector('#datePicker .date-components input').value = '"&sRet&"'document.querySelector('#datePicker .date-components input').click()document.querySelector('#searchForm .search-btn').click()return 123}"sRet = WebBrowser.RunJS(hWeb,js,True,{"bContinueOnError":False,"iDelayAfter":300,"iDelayBefore":200})#icon("@res:c1ng56st-kctq-70ta-lim2-k8di8u4ultsg.png")Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"A","aaname":"确认"}]},"left","click",10000,{"bContinueOnError":False,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False})arrayData = UiElement.DataScrap({"html":[{"id":"base_bd","tag":"DIV"}],"wnd":[{"app":"chrome","cls":"Chrome_WidgetWin_1","title":"*"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}]},{"Columns":[{"props":["text"],"selecors":[{"className":"base_main","index":0,"prefix":"","tag":"div","value":"div.base_main"},{"className":"searchresult_content","index":0,"prefix":">","tag":"div","value":"div.searchresult_content"},{"className":"cabinV2","index":0,"prefix":">","tag":"div","value":"div.cabinV2"},{"className":"","index":0,"prefix":">","tag":"div","value":"div"},{"className":"","index":2,"prefix":">","tag":"div","value":"div:nth-child(2)"},{"className":"","index":1,"prefix":">","tag":"div","value":"div:nth-child(1)"},{"index":0,"prefix":">","tag":"div","value":"div"},{"className":"flight_card_content","index":0,"prefix":">","tag":"div","value":"div.flight_card_content"},{"index":0,"prefix":">","tag":"div","value":"div"},{"className":"inb logo","index":0,"prefix":">","tag":"div","value":"div.inb.logo"}]},{"props":["text"],"selecors":[{"className":"base_main","index":0,"prefix":"","tag":"div","value":"div.base_main"},{"className":"searchresult_content","index":0,"prefix":">","tag":"div","value":"div.searchresult_content"},{"className":"cabinV2","index":0,"prefix":">","tag":"div","value":"div.cabinV2"},{"className":"","index":0,"prefix":">","tag":"div","value":"div"},{"className":"","index":2,"prefix":">","tag":"div","value":"div:nth-child(2)"},{"className":"","index":1,"prefix":">","tag":"div","value":"div:nth-child(1)"},{"index":0,"prefix":">","tag":"div","value":"div"},{"className":"flight_card_content","index":0,"prefix":">","tag":"div","value":"div.flight_card_content"},{"index":0,"prefix":">","tag":"div","value":"div"},{"className":"inb right","index":0,"prefix":">","tag":"div","value":"div.inb.right"},{"className":"time_box","index":0,"prefix":">","tag":"div","value":"div.time_box"},{"className":"time","index":0,"prefix":">","tag":"strong","value":"strong.time"}]},{"props":["text"],"selecors":[{"className":"base_main","index":0,"prefix":"","tag":"div","value":"div.base_main"},{"className":"searchresult_content","index":0,"prefix":">","tag":"div","value":"div.searchresult_content"},{"className":"cabinV2","index":0,"prefix":">","tag":"div","value":"div.cabinV2"},{"className":"","index":0,"prefix":">","tag":"div","value":"div"},{"className":"","index":2,"prefix":">","tag":"div","value":"div:nth-child(2)"},{"className":"","index":1,"prefix":">","tag":"div","value":"div:nth-child(1)"},{"index":0,"prefix":">","tag":"div","value":"div"},{"className":"flight_card_content","index":0,"prefix":">","tag":"div","value":"div.flight_card_content"},{"index":0,"prefix":">","tag":"div","value":"div"},{"className":"inb left","index":0,"prefix":">","tag":"div","value":"div.inb.left"},{"className":"time_box","index":0,"prefix":">","tag":"div","value":"div.time_box"},{"className":"time","index":0,"prefix":">","tag":"strong","value":"strong.time"}]},{"props":["text"],"selecors":[{"className":"base_main","index":0,"prefix":"","tag":"div","value":"div.base_main"},{"className":"searchresult_content","index":0,"prefix":">","tag":"div","value":"div.searchresult_content"},{"className":"cabinV2","index":0,"prefix":">","tag":"div","value":"div.cabinV2"},{"className":"","index":0,"prefix":">","tag":"div","value":"div"},{"className":"","index":2,"prefix":">","tag":"div","value":"div:nth-child(2)"},{"className":"","index":1,"prefix":">","tag":"div","value":"div:nth-child(1)"},{"index":0,"prefix":">","tag":"div","value":"div"},{"className":"flight_card_content","index":0,"prefix":">","tag":"div","value":"div.flight_card_content"},{"index":0,"prefix":">","tag":"div","value":"div"},{"index":0,"prefix":">","tag":"div","value":"div"},{"className":"","index":0,"prefix":">","tag":"div","value":"div"},{"className":"base_price02","index":0,"prefix":">","tag":"span","value":"span.base_price02"}]}],"ExtractTable":0},{"objNextLinkElement":"","iMaxNumberOfPage":1,"iMaxNumberOfResult":-1,"iDelayBetweenMS":1000,"bContinueOnError":False})i=0// 将抓取的数据中添加序号For Each value In arrayDatai=i+1arrRet = Unshift(value,i)Next// 构建数据表objDatatable = Datatable.BuildDataTable(arrayData,["序号","航班号","出发时间","到达时间","价格"])objDatatable = Datatable.GetDataTableByArray(objDatatable,True)objExcelWorkBook = Excel.OpenExcel("C:\\Users\\Administrator\\Desktop\\初级uibot考试.xlsx",True,"Excel","","")// 将抓取的数据写入excelExcel.WriteRange(objExcelWorkBook,"Sheet1","A1",objDatatable,False)Excel.Save(objExcelWorkBook)sRet = Dialog.InputBox("请选择你要订的航班编号","UiBot","",False)If (IsNumeric(CInt(sRet))) Dialog.MsgBox("输入的数字不合法","UiBot","0","1",0) End IfsRet=CInt(sRet+1)TracePrint(sRet)arrayRet = Excel.ReadRange(objExcelWorkBook,"Sheet1","A"&sRet&":E"&sRet)TracePrint(arrayRet)s=""For Each value In arrayRet[0]s=s&value&"\n"NextiRet = Dialog.MsgBox(s,"UiBot","0","1",0)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。