|
bs的使用dom对象来做,我试过了,贴几行代码出来
而 cs的就不太清楚了
希望 对你有启发
Systemutil.Run "C:\Program Files\Internet Explorer\iexplore.exe", "", "", "open"
Browser("企业招聘").Page("企业招聘").Sync
Browser("企业招聘").Navigate "http://www.eptrc.com/job_list.aspx"
Browser("企业招聘").Page("企业招聘").Sync
Set dom = Browser("企业招聘").Page("企业招聘").Object.documentElement
flag = 0
Set odivs = dom.getElementsByTagName("div")
For i = 0 to odivs.length - 1
If (trim(odivs(i).innertext)) = "企业招聘信息" Then
' msgbox odivs(i).innertext & ", " & i
flag = flag + 1
Set mydiv = odivs(i)
Exit for
End If
Next
'msgbox flag
dim content
If flag = 1 Then
flag = 0
Set strCompanyNameTitleDiv = mydiv.parentnode
If trim(strCompanyNameTitleDiv.classname) = "texttitle" Then
Set mysearchtable = strCompanyNameTitleDiv.nextsibling
Set mychilddivs = mysearchtable.childnodes
For i = 0 to mychilddivs.length - 1
If trim(myChildDIVs.item(i).classname) = "row" or trim(myChildDIVs.item(i).classname) = "rowhl" Then
flag = flag + 1
set cpNode = myChildDIVs.item(i).firstChild.getElementsByTagName("A").item(0).attributes
myhref = myChildDIVs.item(i).firstChild.getElementsByTagName("A").item(0).href
If i < 1 Then
Systemutil.Run "C:\Program Files\Internet Explorer\iexplore.exe", "", "", "open"
Browser("Browser").Navigate myhref
End If
strCompanyName = myChildDIVs.item(i).firstChild.getElementsByTagName("DIV").item(1).innertext
content = content & strCompanyName & vbCrLf
End If
Next
End If
End If
msgbox attr
msgbox content |
|