当我尝试下面的我得到一个错误“对象不支持属性或方法”
Sub Testing()
Dim driver As New SeleniumWrapper.WebDriver
driver.Start "chrome", "http://www.tsn.ca/fury-upsets-klitschko-to-become-heavyweight-champion-1.401257"
driver.Open "/"
MsgBox driver.getElementsByClassName("headline").Text
End Sub
我也试过driver.getElementsByClassName("headline")(0).Text
2条答案
按热度按时间anauzrmj1#
不是“得到”,而是“发现”:
或者,使用CSS选择器:
lbsnaicq2#
website中的headline元素是:
因此,您可以使用以下定位器策略之一: