是否可以结合使用vba和硒来创建后期绑定方法?如果是这样的话,那会怎样?我搜索了很多,但找不到任何匹配项。任何帮助,将不胜感激。
如下所示:
Sub Test_Selenium()
Dim post As Object
With CreateObject("ChromeDriver") ''it's a faulty approach as I'm not familiar with it
.get "https://stackoverflow.com/questions/tagged/web-scraping"
For Each post In .FindElementsByCss(".question-hyperlink")
r = r + 1: Cells(r, 1) = post.Text
Next post
.Quit
End With
End Sub
并产生常见错误
activeX组件无法创建对象
我相信您正在寻找的是:
Sub Test_Selenium()
Dim post As Object
With CreateObject("Selenium.ChromeDriver")
.get "https://stackoverflow.com/questions/tagged/web-scraping"
For Each post In .FindElementsByCss(".question-hyperlink")
r = r + 1: Cells(r, 1) = post.Text
Next post
.Quit
End With
End Sub
但是,如果有可能,最好使用早期绑定。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句