【发布时间】:2017-03-29 19:16:18
【问题描述】:
我想使用 excel 浏览网页。但该网站不像普通网站(亚马逊、谷歌等)那样使用 ID。该网站是http://www.scoopmae.com/。我将如何选择“预订演示”按钮。我通常会使用 getelementbyID,但我不知道 id。我也尝试过标签和类,但没有运气。
Sub scoop()
Set objie = CreateObject("InternetExplorer.Application")
objie.Top = 0
objie.Left = 0
objie.Width = 1600
objie.Height = 900
objie.Visible = True 'We can see IE
On Error Resume Next
objie.navigate ("http://scoopmae.com")
Do
DoEvents
Loop Until objue.readystate = 4
Application.Wait (Now + TimeValue("0:00:02"))
'MsgBox ("wait")
'click button
'objie.document.getElementsById("scoop-sort").Click
x = objie.document.getElementsByClassName("a")
Cells(1, 2) = x
End Sub
【问题讨论】:
-
我刚刚就这个问题回答了一个非常相似的问题。 stackoverflow.com/questions/43095155/…
标签: excel vba web-scraping