我希望自动化流程以从
获取所有的#我能够使用vbscript在第一页上获取建议,但是当我将.click()事件发送到下一页锚标记或任何页码时,没有任何反应。 当我检查元素时,附加页码的锚标记被鼠标向上事件触发 下一页>
请有人帮忙吗
以下是代码:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objShellApp = CreateObject("Shell.Application")
dim fso: set fso = CreateObject("Scripting.FileSystemObject")
Set obj1 = CreateObject("Scripting.FileSystemObject")
wscript.sleep 5000
url="https://access.redhat.com/products/red-hat-enterprise-linux/errata#? &col=portal_errata&language=All&portal_product=Red+Hat+Enterprise+Linux&portal_product_version=7"
Set ie = WScript.CreateObject("InternetExplorer.Application")
ie.ToolBar = 0
ie.StatusBar =0
ie.Width = 100
ie.Height = 100
ie.Left = 0
ie.Top = 0
ie.Navigate(url)
ie.visible=true
For Each objWindow In objShellApp.Windows
Wscript.sleep 1000
If (Instr(objWindow.LocationName,"Red Hat")) Then
Set ie = objWindow
exit for
'Wscript.echo objWindow.LocationName
End If
Next
do until ie.readyState = 4 : wscript.sleep 10 : loop
Wscript.sleep 10000
set oElm=ie.document.getElementById("searchResults")
if oElm Is Nothing then
MsgBox("element does not exist")
else
Set objFileToWrite =
CreateObject("Scripting.FileSystemObject").OpenTextFile("D:\RHEL7.html",8,true)
objFileToWrite.WriteLine(oElm.innerHTML)
objFileToWrite.Close
Set objFileToWrite = Nothing
end if
set Elems = ie.Document.GetElementsByTagName("a")
' set Elems=ie.Document.getElementById("next")
i=0
For Each elem In Elems
REM Wscript.echo i & "-----------"
Dim str
str=elem.GetAttribute("class")
If ( str="pager" And str <> "" ) Then
ContentStr = elem.GetAttribute("title")
if (Instr(ContentStr,"Go to page 2")) then
'elem.fireEvent "onmouseup"
elem.click
msgbox elem.GetAttribute("title")
end if
End If
Next