1、绑定、创建 浏览器对象
//++++++++++++++++++++++++++++++++++++++++++++ // 1.打开浏览器 //++++++++++++++++++++++++++++++++++++++++++++ // 浏览器类型: 360se edge chrome g_浏览器_类型 = "edge" g_浏览器_对象 = WebBrowser.BindBrowser(g_浏览器_类型,30000,{"bContinueOnError":true,"iDelayAfter":0,"iDelayBefore":0}) If IsNull(g_浏览器_对象) g_浏览器_对象=WebBrowser.Create(g_浏览器_类型,"about:blank",30000,{"bContinueOnError":true,"iDelayAfter":0,"iDelayBefore":0,"sStartArgs":""}) End If
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ If isNull(g_浏览器_对象) // 浏览器类型: 360se edge chrome g_浏览器_类型 = "edge" g_浏览器_对象 = WebBrowser.BindBrowser(g_浏览器_类型,30000,{"bContinueOnError":true,"iDelayAfter":0,"iDelayBefore":0}) If IsNull(g_浏览器_对象): g_浏览器_对象=WebBrowser.Create(g_浏览器_类型,"about:blank",30000,{"bContinueOnError":true,"iDelayAfter":0,"iDelayBefore":0,"sStartArgs":""}) End If // 跳转至“刷价”页面 // WebBrowser.GoURL(g_浏览器_对象,"https://www.maersk.com.cn/instantPrice/",true,{},20000,{"bContinueOnError":true,"iDelayAfter":0,"iDelayBefore":0}) End If //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2、当前页面URL
Dim cur_page_url = WebBrowser.GetURL(g_浏览器_对象,{"bContinueOnError":true,"iDelayAfter":0,"iDelayBefore":0}) TracePrint("当前页面地址:" & cur_page_url) If api.is_page_url(cur_page_url, "https://www.maersk.com.cn/instantPrice/") // 点击“搜索”按钮 Mouse.Action(@ui"edge_查询_搜索_按钮","left","click",10000,{"bContinueOnError": true, "iDelayAfter": 0, "iDelayBefore": 0, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate", "bMoveSmoothly": true}) End If