[英]Using the Internet Explorer object to scrape information?
I am attempting to scrape some information from a website. 我试图从网站上抓取一些信息。 The link I am referencing is: https://web.tmxmoney.com/quote.php?qm_symbol=WEED 我引用的链接是: https : //web.tmxmoney.com/quote.php?qm_symbol=WEED
I'm creating an Internet Explorer object with the following: 我正在使用以下内容创建Internet Explorer对象:
Dim appIE As Object
Set appIE = CreateObject("internetexplorer.application")
Dim ticker As String
ticker = "BRB"
With appIE
.Navigate "https://web.tmxmoney.com/quote.php?qm_symbol=" & ticker
.Visible = False
End With
Do While appIE.Busy
Loop
I am then attempting to get the contents of a class with the following: 然后,我尝试使用以下内容获取类的内容:
Set testing = appIE.document.getElementsByClassName("quote-name")(0).textContent
Debug.Print (testing)
However, I am receiving the error: Type Mismatach
. 但是,我收到错误: Type Mismatach
。 The following code will run fine though: appIE.document.getElementsByClassName("quote-name")
. 但是,以下代码可以正常运行: appIE.document.getElementsByClassName("quote-name")
。
My desired content is the following and can run this fine in the IE console. 我想要的内容如下,可以在IE控制台中正常运行。
"
Brick Brewing Co. Limited
Exchange: TSX Exchange |
Jul 26, 2017, 2:46 PM EDT "
Any ideas on what might be wrong? 有什么想法可能有问题吗?
Try these lines of code 尝试这些代码行
testing = appIE.document.getElementsByClassName("quote-name")(0).textContent 测试= appIE.document.getElementsByClassName(“ quote-name”)(0).textContent
Debug.Print (testing) Debug.Print(测试)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.