【发布时间】:2020-05-26 05:39:04
【问题描述】:
我对网络抓取相当陌生,我从使用 Chrome 的 VBA/Excel 中的 Selenium 开始。我的目标元素是菜单项。
在某些网站中,我可以找到元素,但无法获取它们的“href”。这是destination website。我想要页面右侧菜单项的“href”。
这是我尝试过的:
' geting the menus, working well:
Set mnus = bot1.FindElementsByClass("topmenu")
MenuCounter = 0
For Each mnu In mnus
'getting the href, fails
lnk = mnu.Attribute("href")
我也尝试了一些其他的方法,但没有成功。
请注意,我不仅想要这个特定元素的 href(其 href 是“art”)。我还想要其他等效菜单项的href(第一项除外)。
【问题讨论】:
-
需要更多信息。更多代码。有关它如何不工作的更多图片/信息。由于您是 Web Scraping 的新手,也许您可以看看 Beautiful Soup 和 Python
标签: vba selenium google-chrome href screen-scraping