Foxtable(狐表)用户栏目专家坐堂 → 【已解决】[求助]通过元素align、class获取文字。如何获取网页数据?


  共有7917人关注过本帖树形打印复制链接

主题:【已解决】[求助]通过元素align、class获取文字。如何获取网页数据?

帅哥哟,离线,有人找我吗?
zto001
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
【已解决】[求助]通过元素align、class获取文字。如何获取网页数据?  发帖心情 Post By:2019/1/1 13:21:00 [显示全部帖子]

[求助]如何获取网页数据?
普通网页源代码里面数据的我懂怎么获取,但是源代码里面没有数据,都是js,js点进去还都是乱码,这样的怎么获取数据?

需要怎么做?



我上传不了附件,我复制过来


<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut iconhref=/favicon.ico><link rel=stylesheet href=https://sv-source.zt-express.com/gongdan/css/element-2.3.9.min.css><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=renderer content=webkit><script>var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?dea3191ac436c1d00236cc3636757629";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();

var infors ="";</script><title>客服工单管理系统</title><link rel=preload as=script href=/js/vendor.1aa25075.js><link rel=preload as=script href=/js/app.a8e9b3c2.js><link rel=preload as=style href=/css/app.ecef4994.css><link rel=prefetch href=/js/vendor-async.0.01afd353.js><link rel=prefetch href=/js/1.1.34160073.js><link rel=prefetch href=/js/2.2.d7ca5b28.js><link rel=prefetch href=/js/3.3.f8835813.js><link rel=prefetch href=/js/4.4.285e10dc.js><link rel=prefetch href=/js/5.5.f8e23c45.js><link rel=prefetch href=/js/6.6.d4635f09.js><link rel=prefetch href=/js/7.7.85c1c569.js><link rel=prefetch href=/js/8.8.b08f6fb0.js><link rel=prefetch href=/js/9.9.7da0083d.js><link rel=prefetch href=/js/10.10.13612fff.js><link rel=prefetch href=/js/11.11.e7dfe5cd.js><link rel=prefetch href=/js/12.12.0f8d614f.js><link rel=prefetch href=/js/13.13.7b99b65c.js><link rel=prefetch href=/js/14.14.a97a7698.js><link rel=prefetch href=/js/15.15.0ecfcc00.js><link rel=prefetch href=/js/16.16.755d78c1.js><link rel=prefetch href=/js/17.17.a1b0d7cb.js><link rel=prefetch href=/js/18.18.746910a9.js><link rel=prefetch href=/js/19.19.fae59142.js><link rel=prefetch href=/js/20.20.5d021601.js><link rel=prefetch href=/js/21.21.f2c0f579.js><link rel=prefetch href=/js/22.22.30173cc3.js><link rel=prefetch href=/js/23.23.e3f6df0d.js><link rel=prefetchhref=/js/24.24.b429dbc8.js><link rel=prefetch href=/js/25.25.fe12e056.js><link rel=prefetch href=/js/26.26.ccf862a8.js><link rel=prefetch href=/js/27.27.173af5b8.js><link rel=prefetch href=/js/28.28.b03e0447.js><link rel=prefetch href=/js/29.29.124a0089.js><link rel=prefetch href=/js/30.30.d8f41248.js><link rel=prefetch href=/js/31.31.2fc7fb00.js><link rel=prefetch href=/js/32.32.fac7b329.js><link rel=prefetch href=/js/33.33.012df7a2.js><link rel=prefetch href=/js/34.34.a11066ef.js><link rel=prefetch href=/js/35.35.85839c43.js><link rel=prefetch href=/js/36.36.a331d2d5.js><link rel=prefetch href=/js/37.37.209138ec.js><link rel=prefetch href=/js/38.38.ffbcb2da.js><link rel=prefetch href=/js/39.39.83541853.js><link rel=prefetch href=/js/40.40.07687e01.js><link rel=prefetch href=/js/41.41.80933101.js><link rel=prefetch href=/js/42.42.dd13869d.js><link rel=prefetch href=/js/43.43.fb6ab927.js><link rel=prefetch href=/js/44.44.f7b92405.js><link rel=prefetch href=/js/45.45.f2263728.js><link rel=prefetch href=/js/46.46.56dd2e6f.js><link rel=prefetch href=/js/47.47.061581bd.js><link rel=prefetch href=/js/48.48.15264987.js><link rel=prefetch href=/js/49.49.c1aba0ad.js><link rel=prefetch href=/js/50.50.c45a1e5a.js><link rel=prefetch href=/js/51.51.681d46e3.js><link rel=prefetch href=/js/52.52.2e8dda93.js><link rel=prefetchhref=/js/53.53.c58143a8.js><link rel=prefetch href=/js/54.54.a0ea12c6.js><link rel=prefetch href=/js/55.55.33719342.js><link rel=prefetch href=/js/56.56.ad21eed3.js><link rel=prefetch href=/js/57.57.17695cc3.js><link rel=prefetch href=/js/58.58.bdc91e54.js><link rel=prefetch href=/js/59.59.106de653.js><link rel=prefetch href=/js/60.60.eed7709d.js><link rel=prefetch href=/js/61.61.4180030e.js><link rel=prefetch href=/js/62.62.53212ba9.js><link rel=prefetch href=/js/63.63.dd7f0d3f.js><link rel=prefetch href=/js/64.64.dd6554db.js><link rel=prefetch href=/js/65.65.836eb310.js><link rel=prefetch href=/js/66.66.ddbe9c20.js><link rel=prefetch href=/js/67.67.8e778f0b.js><link rel=prefetch href=/js/68.68.1f872fd1.js><link rel=prefetch href=/js/69.69.32ed4a1e.js><link rel=prefetch href=/js/70.70.687ed7aa.js><link rel=prefetch href=/js/71.71.a2278bd5.js><link rel=prefetch href=/js/72.72.e24c76e5.js><link rel=prefetch href=/js/73.73.dfb4e277.js><link rel=prefetch href=/js/74.74.b93ccdd2.js><link rel=prefetch href=/js/75.75.a77fe3d9.js><link rel=prefetch href=/js/76.76.32ee7a88.js><link rel=prefetch href=/js/77.77.5c99cb2b.js><link rel=prefetch href=/js/78.78.c0494060.js><link rel=prefetch href=/js/79.79.ea37eb8c.js><link rel=prefetch href=/js/80.80.096f67ea.js><link rel=prefetch href=/js/81.81.b09fd1e7.js><link rel=prefetchhref=/js/82.82.45218588.js><link rel=prefetch href=/js/83.83.3c9e0faf.js><link rel=prefetch href=/js/84.84.cdfa0129.js><link rel=prefetch href=/js/85.85.adafd3ff.js><link rel=prefetch href=/js/86.86.dfd9470a.js><link rel=prefetch href=/js/87.87.3a172e57.js><link rel=prefetch href=/js/88.88.50d53a73.js><link rel=prefetch href=/js/89.89.9977ddc3.js><link rel=prefetch href=/js/90.90.7aedd5fc.js><link rel=prefetch href=/js/91.91.52bde6ab.js><link rel=prefetch href=/js/92.92.27157773.js><link href=/css/app.ecef4994.css rel=stylesheet></head><body><noscript><strong>We're sorry but crm-serve doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=https://w3.zto.com/cdn/zto-layer.min.js></script><script>console.log(window.Vue)
var url = window.location.href
if(url.indexOf("b_i") < 0) {
var script = document.createElement("script")
script.type = "text/javascript"
script.appendChild(document.createTextNode("window.ztoLayer({ appId: 'ZTO_SV_CRMWORKORDER', delay: 1000 })"))
document.body.appendChild(script)
}</script><script src=https://connect.zto.com/jssdk/alpha.js></script><script src=https://sv-source.zt-express.com/crm/Scripts/jquery-2.1.3.min.js></script><script src=https://sv-source.zt-express.com/gongdan/js/vue.min.js></script><script src=https://sv-source.zt-express.com/gongdan/js/vuex.min.js></script><script src=https://sv-source.zt-express.com/gongdan/js/axios.min.js></script><script src=https://sv-source.zt-express.com/gongdan/js/vue-router.min.js></script><script src=https://sv-source.zt-express.com/gongdan/js/element-2.3.9.min.js></script><script type=text/javascript>!function(e){var d=window.webpackJsonp;window.webpackJsonp=function(a,n,r){for(var t,o,b,u=0,i=[];u<a.length;u++)o=a[u],c[o]&&i.push(c[o][0]),c[o]=0;for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t]);for(d&&d(a,n,r);i.length;)i.shift()();if(r)for(u=0;u<r.length;u++)b=f(f.s=r[u]);return b};var a={},c={95:0};function f(d){if(a[d])return a[d].exports;var c=a[d]={i:d,l:!1,exports:{}};return e[d].call(c.exports,c,c.exports,f),c.l=!0,c.exports}f.e=function(e){var d=c[e];if(0===d)return new Promise(function(e){e()});if(d)return d[2];var a=new Promise(function(a,f){d=c[e]=[a,f]});d[2]=a;var n=document.getElementsByTagName("head")[0],r=document.createElement("script");r.type="text/javascript",r.charset="utf-8",r.async=!0,r.timeout=12e4,f.nc&&r.setAttribute("nonce",f.nc),r.src=f.p+"js/"+({0:"vendor-async"}[e]||e)+"."+e+"."+{0:"01afd353",1:"34160073",2:"d7ca5b28",3:"f8835813",4:"285e10dc",5:"f8e23c45",6:"d4635f09",7:"85c1c569",8:"b08f6fb0",9:"7da0083d",10:"13612fff",11:"e7dfe5cd",12:"0f8d614f",13:"7b99b65c",14:"a97a7698",15:"0ecfcc00",16:"755d78c1",17:"a1b0d7cb",18:"746910a9",19:"fae59142",20:"5d021601",21:"f2c0f579",22:"30173cc3",23:"e3f6df0d",24:"b429dbc8",25:"fe12e056",26:"ccf862a8",27:"173af5b8",28:"b03e0447",29:"124a0089",30:"d8f41248",31:"2fc7fb00",32:"fac7b329",33:"012df7a2",34:"a11066ef",35:"85839c43",36:"a331d2d5",37:"209138ec",38:"ffbcb2da",39:"83541853",40:"07687e01",41:"80933101",42:"dd13869d",43:"fb6ab927",44:"f7b92405",45:"f2263728",46:"56dd2e6f",47:"061581bd",48:"15264987",49:"c1aba0ad",50:"c45a1e5a",51:"681d46e3",52:"2e8dda93",53:"c58143a8",54:"a0ea12c6",55:"33719342",56:"ad21eed3",57:"17695cc3",58:"bdc91e54",59:"106de653",60:"eed7709d",61:"4180030e",62:"53212ba9",63:"dd7f0d3f",64:"dd6554db",65:"836eb310",66:"ddbe9c20",67:"8e778f0b",68:"1f872fd1",69:"32ed4a1e",70:"687ed7aa",71:"a2278bd5",72:"e24c76e5",73:"dfb4e277",74:"b93ccdd2",75:"a77fe3d9",76:"32ee7a88",77:"5c99cb2b",78:"c0494060",79:"ea37eb8c",80:"096f67ea",81:"b09fd1e7",82:"45218588",83:"3c9e0faf",84:"cdfa0129",85:"adafd3ff",86:"dfd9470a",87:"3a172e57",88:"50d53a73",89:"9977ddc3",90:"7aedd5fc",91:"52bde6ab",92:"27157773"}[e]+".js";var t=setTimeout(o,12e4);function o(){r.onerror=r.onload=null,clearTimeout(t);var d=c[e];0!==d&&(d&&d[1](new Error("Loading chunk "+e+" failed.")),c[e]=void 0)}return r.onerror=r.onload=o,n.appendChild(r),a},f.m=e,f.c=a,f.d=function(e,d,a){f.o(e,d)||Object.defineProperty(e,d,{configurable:!1,enumerable:!0,get:a})},f.n=function(e){var d=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(d,"a",d),d},f.o=function(e,d){return Object.prototype.hasOwnProperty.call(e,d)},f.p="/",f.oe=function(e){throw e}}([]);
//# sourceMappingURL=/js/manifest.4fdbef85.js.map</script><script type=text/javascript src=/js/vendor.1aa25075.js></script><script type=text/javascript src=/js/app.a8e9b3c2.js></script></body></html>
[此贴子已经被作者于2019/1/15 12:45:17编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/1/2 9:56:00 [显示全部帖子]

使我们内网的一个系统,里面不像普通网页一样,网页内容会在源代码里面。他的全都是js,都不存在数据内容。不知道怎么弄

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/1/9 9:29:00 [显示全部帖子]

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&replyID=852625&ID=127277&skin=1
获取网页数据

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/1/10 10:17:00 [显示全部帖子]

放弃了,关于网页的,没有ID或者name可以找。搞了半天也没办法。

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/1/10 10:46:00 [显示全部帖子]

还是不会,class有,name没有,你发的这些例子都是ID或者name的

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/1/11 15:29:00 [显示全部帖子]

获取信息代码:


Dim web As New System.Windows.Forms.WebBrowser() web.Navigate("http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=129570") Do Until web.ReadyState = 4 Application.DoEvents Loop Dim elems As object = web.Document.GetElementById("textstyle_10") '获取信息ID If elems IsNot Nothing Then msgbox(elems.InnerText) End If


这样没错也能获取,但是我不知道怎么用class去获取

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/1/11 17:03:00 [显示全部帖子]

Dim web As New System.Windows.Forms.WebBrowser()
web.Navigate("http://www.hzctc.cn/OpenBidRecord/Index?id=36177CC9-5F91-473F-84E6-A2EFA35D6DD9&tenderID=969B1A8D-1A57-4A21-864F-A5E98F8288FB&ModuleID=486")

Do Until web.ReadyState = 4 AndAlso web.Document.GetElementById("Table1") IsNot Nothing
    Application.DoEvents
Loop


弱弱的问问,我已经打开网页了。需要从控件WebBrowser1当前所在的页面获取信息,需要把这段代码应该改成怎样呢?


 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/1/12 13:09:00 [显示全部帖子]

Dim web as System.Windows.Forms.WebBrowser = e.form.controls("webbrowser1").Basecontrol

Do Until web.ReadyState = 4 AndAlso web.Document.GetElementById("Table1") IsNot Nothing
    Application.DoEvents
Loop

Dim elems As object = web.Document.GetElementsByTagName("div")
For Each elem As object In elems
    If elem.getattribute("classname") = "row cl" Then
        If elem.InnerText.contains("工程编号") Then
            msgbox(elem.GetElementsByTagName("span")(0).innerText)
        ElseIf elem.InnerText.contains("建设单位") Then
            msgbox(elem.GetElementsByTagName("span")(0).innerText)
        End If
    End If

Next

elems = web.Document.GetElementById("Table1").GetElementsByTagName("tr")
For i As Integer = 1 To elems.count-2
    Dim tds = elems(i).getelementsbytagname("td")

    msgbox(tds(0).InnerText & " " & tds(1).InnerText)
Next


很抱歉,确实不懂这个代码,蓝色字体都是不懂得,下面是我那网页代码,可以告诉我一下我需要获取粉色字体的信息吗?msgbox(粉色字体的字符串)


网页的代码是:


<table cellspacing="0" cellpadding="0" border="0" class="el-table__body" style="width: 1190px;"><colgroup><col name="el-table_1_column_1" width="50"><col name="el-table_1_column_2" width="60"><col name="el-table_1_column_3" width="200"><col name="el-table_1_column_4" width="80"><col name="el-table_1_column_5" width="170"><col name="el-table_1_column_6" width="160"><col name="el-table_1_column_7" width="160"><col name="el-table_1_column_8" width="80"><col name="el-table_1_column_9" width="80"><col name="el-table_1_column_10" width="150"></colgroup><tbody><tr class="el-table__row"><td class="el-table_1_column_1 is-center  is-hidden"><div class="cell"><div>1</div></div></td><td class="el-table_1_column_2 is-center el-table-column--selection is-hidden"><div class="cell"><label role="checkbox" class="el-checkbox"><span aria-checked="mixed" class="el-checkbox__input"><span class="el-checkbox__inner"></span><input type="checkbox" aria-hidden="true" class="el-checkbox__original" value=""></span><!----></label></div></td><td class="el-table_1_column_3 is-center  is-hidden"><div class="cell"><button data-v-6cf7ad1e="" type="button" class="el-button el-button--primary el-button--small is-plain"><!----><!----><span>抢单</span></button><!----></div></td><td class="el-table_1_column_4 is-center "><div class="cell">KT2019011223834</div></td><td class="el-table_1_column_5 is-center "><div class="cell"><a data-v-6cf7ad1e="" href="#/customerServiceComplaint/reportForm/fastTrack?BillCode=75122914346273" class="error-column">75122914346273</a></div></td><td class="el-table_1_column_6 is-center "><div class="cell">2019-01-12 12:47:03</div></td><td class="el-table_1_column_7 is-center "><div class="cell">2019-01-13 11:47:03</div></td><td class="el-table_1_column_8 is-center "><div class="cell"></div></td><td class="el-table_1_column_9 is-center "><div class="cell">否</div></td><td class="el-table_1_column_10 is-center "><div class="cell"><span data-v-6cf7ad1e="" class="el-tag el-tooltip el-tag--info el-tag--small" aria-describedby="el-tooltip-7124" tabindex="0">暂无此信息<!----></span></div></td></tr><tr class="el-table__row error-row"><td class="el-table_1_column_1 is-center  is-hidden"><div class="cell"><div>2</div></div></td><td class="el-table_1_column_2 is-center el-table-column--selection is-hidden"><div class="cell"><label role="checkbox" class="el-checkbox"><span aria-checked="mixed" class="el-checkbox__input"><span class="el-checkbox__inner"></span><input type="checkbox" aria-hidden="true" class="el-checkbox__original" value=""></span><!----></label></div></td><td class="el-table_1_column_3 is-center  is-hidden"><div class="cell"><button data-v-6cf7ad1e="" type="button" class="el-button el-button--primary el-button--small is-plain"><!----><!----><span>抢单</span></button><button data-v-6cf7ad1e="" disabled="disabled" type="button" class="el-button el-button--warning el-button--small is-disabled is-plain"><!----><!----><span>已分配业务员</span></button></div></td><td class="el-table_1_column_4 is-center "><div class="cell">KT2019011221697</div></td><td class="el-table_1_column_5 is-center "><div class="cell"><a data-v-6cf7ad1e="" href="#/customerServiceComplaint/reportForm/fastTrack?BillCode=75121716480701" class="error-column">75121716480701</a></div></td><td class="el-table_1_column_6 is-center "><div class="cell">2019-01-12 12:20:16</div></td><td class="el-table_1_column_7 is-center "><div class="cell">2019-01-13 11:20:16</div></td><td class="el-table_1_column_8 is-center "><div class="cell"></div></td><td class="el-table_1_column_9 is-center "><div class="cell">否</div></td><td class="el-table_1_column_10 is-center "><div class="cell"><span data-v-6cf7ad1e="" class="el-tag el-tooltip el-tag--info el-tag--small" aria-describedby="el-tooltip-1990" tabindex="0">菜鸟虚假签收<!----></span></div></td></tr><tr class="el-table__row"><td class="el-table_1_column_1 is-center  is-hidden"><div class="cell"><div>3</div></div></td><td class="el-table_1_column_2 is-center el-table-column--selection is-hidden"><div class="cell"><label role="checkbox" class="el-checkbox"><span aria-checked="mixed" class="el-checkbox__input"><span class="el-checkbox__inner"></span><input type="checkbox" aria-hidden="true" class="el-checkbox__original" value=""></span><!----></label></div></td><td class="el-table_1_column_3 is-center  is-hidden"><div class="cell"><button data-v-6cf7ad1e="" type="button" class="el-button el-button--primary el-button--small is-plain"><!----><!----><span>抢单</span></button><!----></div></td><td class="el-table_1_column_4 is-center "><div class="cell">KT2019011223328</div></td><td class="el-table_1_column_5 is-center "><div class="cell"><a data-v-6cf7ad1e="" href="#/customerServiceComplaint/reportForm/fastTrack?BillCode=75122560250458" class="error-column">75122560250458</a></div></td><td class="el-table_1_column_6 is-center "><div class="cell">2019-01-12 12:40:29</div></td><td class="el-table_1_column_7 is-center "><div class="cell">2019-01-13 11:40:29</div></td><td class="el-table_1_column_8 is-center "><div class="cell"></div></td><td class="el-table_1_column_9 is-center "><div class="cell">否</div></td><td class="el-table_1_column_10 is-center "><div class="cell"><span data-v-6cf7ad1e="" class="el-tag el-tooltip el-tag--info el-tag--small" aria-describedby="el-tooltip-4465" tabindex="0">暂无此信息<!----></span></div></td></tr><!----></tbody></table>


 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/1/12 16:44:00 [显示全部帖子]

Dim web as System.Windows.Forms.WebBrowser = e.form.controls("webbrowser1").Basecontrol

Do Until web.ReadyState = 4 
    Application.DoEvents
Loop

 msgbox(“测试代码正常显示没问题”)


Dim elems As object = web.Document.GetElementsByTagName("td")   ‘这个是查找tb存在多少个遍历多少次吧
For Each elem As object In elems

 msgbox(“测试代码正常显示没问题”)


’红色区域代码一直未执行,一直在循环遍历没停下来过
    If elem.getattribute("classname") = "el-table_1_column_4 is-center" Then
        msgbox(elem.innerText)
    ElseIf elem.getattribute("classname") = "el-table_1_column_5 is-center" Then
        msgbox(elem.innerText)
    End If
Next

很抱歉又来找您了。这个代码执行下来红色区域没执行过一次,一直处于遍历的循环中(不知道循环还是无限执行)。
[此贴子已经被作者于2019/1/12 16:51:57编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
zto001
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1490 积分:10607 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/1/12 17:01:00 [显示全部帖子]

Dim web As System.Windows.Forms.WebBrowser = e.form.controls("webbrowser1").Basecontrol

Do Until web.ReadyState = 4 
    Application.DoEvents
Loop
Dim elems As object = web.Document.GetElementsByTagName("div")
For Each elem As object In elems


    If elem.getattribute("classname") = "cell" Then
        msgbox(elem.innerText)
    End If
Next


我这样成功获取到相关的信息了,但是有两个问题,全部获取之后会刷新网页、还弹出一个错误框,是
Do Until web.ReadyState = 4 
    Application.DoEvents
Loop
这个代码的问题是吗?

还有我获去出来之后,应该怎样才能够让他变成表格数据?
[此贴子已经被作者于2019/1/12 17:05:18编辑过]

 回到顶部
总数 17 1 2 下一页