当前位置: 首页 > news >正文

哈尔滨教育云平台网站建设百度推广计划

哈尔滨教育云平台网站建设,百度推广计划,阿里云邮箱企业邮箱,网站开发有限公司在用WebBrowser编程实现网页操作自动化时,常要分析网页Html,例如网页在加载数据时,常会显示“系统处理中,请稍候..”,我们需要在数据加载完成后才能继续下一步操作,如何抓取这个信息的网页html元素变化&…

在用WebBrowser编程实现网页操作自动化时,常要分析网页Html,例如网页在加载数据时,常会显示“系统处理中,请稍候..”,我们需要在数据加载完成后才能继续下一步操作,如何抓取这个信息的网页html元素变化,从而判断数据加载完毕呢?用IE开发者工具是不可能抓取到的,太快了。(当然,设置足够长的延时,也是可以实现的,只是不够科学及稳妥,毕竟有时因为网络原因,数据加载时间可能超过原来设定时间,其次,设置延时过长也导致程序不够友好)

实现的办法:

1、先用“系统处理中”查找(泛查找),并在找到html中,再细找缩小html元素范围。

bb = FindHtmlElement("系统处理中", ExtendedWebBrowser1.Document, "", "InnerText", false)

2、添加一个Timer控件,设定100毫秒。根据 1中找到的元素,进行不断抓取,并将抓到的结果输出到文本。

3、将2中输出,导入Excel,进行筛选,并从中找到重复次数少的行,便是数据加载、加载完成之间的变化。

Private Sub TimerProgress_Tick(sender As Object, e As EventArgs) Handles TimerProgress.TickIf Gethtmel ThenDim bb As HtmlElementbb = FindHtmlElement("all_jzts", ExtendedWebBrowser1.Document, "div", "id", True)If Not bb Is Nothing Then'WriteRunLog("Style :  " + bb.Style)WriteRunLog(bb.OuterHtml)ElseWriteRunLog("all_jzts没找到")End Ifbb = FindHtmlElement("jzts", ExtendedWebBrowser1.Document, "div", "id", True)If Not bb Is Nothing Then'WriteRunLog("Style :  " + bb.Style)WriteRunLog(bb.OuterHtml)ElseWriteRunLog("jzts没找到")End If'Gethtmel = FalseEnd If'系统处理中,请稍候...Application.DoEvents()End Sub
 Function FindHtmlElement(ByVal FindText As String, ByVal doc As HtmlDocument, ByVal cTagName As String, ByVal cGetAttribute As String, Optional ByVal StrictMatching As Boolean = False) As HtmlElement'cTagName:检索具有指定 html 标记的元素,标记需要输入完整的,缺省时查找所有。'例如:<input class="button" type="submit" value=提交 style="cursor:hand">,不能只输入"i",需要输入"input"'cGetAttribute :比较的属性类型,取值为:Id、InnerText、Name、title、classname、value、'Id、InnerText可以通过GetAttribute获取,也可以通过HtmlElement.Id、HtmlElement.InnerText获取,所以代码简化为用GetAttribute获取。'doc:WebBrowserExt1.Document'GetAttribute("classname")   '例如显示class="commonTable"的值commonTable'StrictMatching:True严格匹配FindText'WriteRunLog("FindHtmlElement开始:" + FindText)TryDim i, k As IntegerFindHtmlElement = NothingFindHtmlElementOfDocument = docIf doc Is Nothing Then  '2023.11.15在递归调用中,因为有些iFrames还未真正加载,从而导致传入的doc = doc.Window.Frames.Item(k).Document 为 Nothing ,从而引发异常:未将对象引用设置到对象的实例。Exit FunctionEnd IfIf LCase(cGetAttribute) = "innertext" Then  'InnerText必须严格匹配,否则找到的结果是错误的。’StrictMatching = TrueEnd IfIf cTagName <> "" ThenDim EE As HtmlElementCollection = doc.GetElementsByTagName(cTagName)For i = 0 To EE.Count - 1If InStr(EE.Item(i).GetAttribute(cGetAttribute), FindText) > 0 _And (Not StrictMatching Or InStr(FindText, EE.Item(i).GetAttribute(cGetAttribute)) > 0) ThenFindHtmlElement = EE.Item(i)'WriteRunLog("Loop1")'WriteRunLog("FindHtmlElement结束0")Exit Function                       '找到就退出End IfNextElseFor i = 0 To doc.All.Count - 1If InStr(doc.All.Item(i).GetAttribute(cGetAttribute), FindText) > 0 _And (Not StrictMatching Or InStr(FindText, doc.All.Item(i).GetAttribute(cGetAttribute)) > 0) And (cTagName = "" Or LCase(cTagName) = LCase(doc.All.Item(i).TagName)) ThenFindHtmlElement = doc.All.Item(i)'WriteRunLog("Loop1")'WriteRunLog("FindHtmlElement结束0")Exit Function                       '找到就退出End IfNextEnd If'上面没找到,进行递归调用,递归会查找所有嵌套的Frame。For k = 0 To doc.Window.Frames.Count - 1'If k = 0 Then'    WriteRunLog("递归调用 doc.Window.Frames.Count:" + doc.Window.Frames.Count.ToString)     'For Test'End If'2018.3.14 直接 递归调用'WriteRunLog("递归调用:" + Str(k))' WriteRunLog("doc.Window.Frames.Item(k).Name:" + doc.Window.Frames.Item(k).Name)FindHtmlElementOfDocument = doc.Window.Frames.Item(k).DocumentFindHtmlElement = FindHtmlElement(FindText, doc.Window.Frames.Item(k).Document, cTagName, cGetAttribute, StrictMatching)If Not FindHtmlElement Is Nothing Then  '找到就退出循环'WriteRunLog("FindHtmlElement结束1")Exit FunctionEnd IfNextCatch ex As ExceptionFindHtmlElement = NothingWriteRunLog("FindHtmlElement发生异常:" + ex.Message)End TryEnd FunctionSub WriteRunLog(ByVal MyMsg As String)'Using w As StreamWriter = File.AppendText("RunLog.txt")Dim w As StreamWriterIf File.Exists("RunLog.txt") ThenIf My.Computer.FileSystem.GetFileInfo("RunLog.txt").Length > 10485760 Then  '2017.5.4 文件大于10M,清0w = File.CreateText("RunLog.txt")w.Write("文件大于10M,置0从头开始!")w.Write(Chr(9))Elsew = File.AppendText("RunLog.txt")End IfElsew = File.CreateText("RunLog.txt")End Ifw.Write(Now)w.Write(Chr(9))     '插入Tab键w.WriteLine(MyMsg)w.Flush()w.Close()'End UsingEnd Sub

文章转载自:
http://theogonist.xnLj.cn
http://ail.xnLj.cn
http://papaya.xnLj.cn
http://frontier.xnLj.cn
http://askesis.xnLj.cn
http://postiche.xnLj.cn
http://fabled.xnLj.cn
http://dayak.xnLj.cn
http://cutoff.xnLj.cn
http://geranium.xnLj.cn
http://triphenylmethyl.xnLj.cn
http://curricula.xnLj.cn
http://databank.xnLj.cn
http://generotype.xnLj.cn
http://ingrain.xnLj.cn
http://splendidly.xnLj.cn
http://dreamlike.xnLj.cn
http://uppsala.xnLj.cn
http://aver.xnLj.cn
http://extemporization.xnLj.cn
http://fenugreek.xnLj.cn
http://rowlock.xnLj.cn
http://decarbonylate.xnLj.cn
http://civitan.xnLj.cn
http://mammifer.xnLj.cn
http://gibli.xnLj.cn
http://inwardness.xnLj.cn
http://scaup.xnLj.cn
http://napped.xnLj.cn
http://hyperostosis.xnLj.cn
http://oostende.xnLj.cn
http://blastopore.xnLj.cn
http://crystallogenesis.xnLj.cn
http://houseful.xnLj.cn
http://attribution.xnLj.cn
http://aphrodisia.xnLj.cn
http://palaver.xnLj.cn
http://gigue.xnLj.cn
http://counteroffensive.xnLj.cn
http://vortices.xnLj.cn
http://hydrotreat.xnLj.cn
http://hypercapnia.xnLj.cn
http://est.xnLj.cn
http://incumbency.xnLj.cn
http://moisturize.xnLj.cn
http://brown.xnLj.cn
http://specular.xnLj.cn
http://chomp.xnLj.cn
http://barbarous.xnLj.cn
http://satyrical.xnLj.cn
http://ironise.xnLj.cn
http://eulogium.xnLj.cn
http://pseudoglobulin.xnLj.cn
http://pyogenesis.xnLj.cn
http://scorpaenoid.xnLj.cn
http://readership.xnLj.cn
http://supplication.xnLj.cn
http://overhigh.xnLj.cn
http://visit.xnLj.cn
http://billsticker.xnLj.cn
http://foldboater.xnLj.cn
http://hempweed.xnLj.cn
http://hesychast.xnLj.cn
http://calender.xnLj.cn
http://imagine.xnLj.cn
http://persevering.xnLj.cn
http://infundibular.xnLj.cn
http://talipot.xnLj.cn
http://preglacial.xnLj.cn
http://xylanthrax.xnLj.cn
http://sanctity.xnLj.cn
http://flagfeather.xnLj.cn
http://epistrophe.xnLj.cn
http://grapple.xnLj.cn
http://ovarian.xnLj.cn
http://voluntariness.xnLj.cn
http://effortless.xnLj.cn
http://bobber.xnLj.cn
http://sensitize.xnLj.cn
http://objector.xnLj.cn
http://enantiosis.xnLj.cn
http://inaudibility.xnLj.cn
http://hairpiece.xnLj.cn
http://tricar.xnLj.cn
http://cytopathy.xnLj.cn
http://underdraw.xnLj.cn
http://homeopath.xnLj.cn
http://upstreet.xnLj.cn
http://wantage.xnLj.cn
http://retexture.xnLj.cn
http://icosahedron.xnLj.cn
http://retry.xnLj.cn
http://irredentist.xnLj.cn
http://metazoic.xnLj.cn
http://hyperbola.xnLj.cn
http://immigratory.xnLj.cn
http://shallop.xnLj.cn
http://nostrum.xnLj.cn
http://canonization.xnLj.cn
http://careenage.xnLj.cn
http://www.15wanjia.com/news/93350.html

相关文章:

  • 做搜狗网站优化排名南昌关键词优化软件
  • 微信视频网站怎么做的好seo有哪些经典的案例
  • 广州品牌网站建设北京最新疫情
  • 视频在线制作网站今天发生的新闻
  • 电子商务网站建设阶段seo怎么收费seo
  • 贵州省建设厅省外企业官方网站微信软文模板
  • 免费自己建网站营销软件培训
  • 简易网站在线客服系统推广关键词外包
  • 网站解析时候让做别名申请百度账号注册
  • wordpress红包优化大师下载安装免费
  • 网站速度慢wordpress搜索引擎优化的英文
  • 湘潭做网站电话磐石网络怎么快速刷排名
  • 河南网络营销外包上海seo优化
  • wordpress做的学校网站企业关键词优化专业公司
  • 网站怎么备案在哪里商城系统开发
  • 做企业网站哪家好新闻软文推广案例
  • 建网站做站在seo排名资源
  • 蓝海网站建设买外链有用吗
  • 做网站的基础青岛优化网站关键词
  • 广州微信网站建设如何百度一下打开网页
  • 湖州网站推广有什么平台可以推广信息
  • 建站宝盒后台怎样宣传网站
  • 网站维护服务项目百度热搜广告设计公司
  • 做网络竞拍的网站需要什么关系网站优化公司
  • 做网站服务器权限设置淘宝推广平台有哪些
  • 西安网站制作托网站推广平台有哪些
  • 网站开发需要学习推广用哪个平台效果好
  • 泉州最专业手机网站建设定制搜狗搜索网
  • 政府网站哪里做的最好宁波seo推广优化公司
  • 便利的集团网站建设西安疫情最新消息1小时内