我必须找到网页的损坏链接。下面是我的代码。 在以下代码的帮助下,少数链接的状态代码为403,但是如果我手动单击相同的链接,则会打开该链接。请帮助我解决此问题。脚本是在testcomplete工具中用vbscript编写的。
谢谢, 切塔纳
Sub Test()
URL = "https://www.webpage.com"
Browsers.Item(btIExplorer).Run(URL)
Set page = Sys.Browser("*").Page("*")
Set links = page.contentDocument.links
linksCount = links.length
For i = 0 To linksCount - 1
Set link = links.item(i)
URL = link.href
Set httpObj = aqHttp.CreateGetRequest(URL)
Set httpObjResult = httpObj.Send
msgbox httpObjResult.StatusCode
Next
End Sub