但是我尝试过,VBA 硒无法在加载的页面中找到现有元素。这是我使用的最后一个代码:
Sub TableData()
Dim driver As New WebDriver
Dim sInfo As String
With driver
.Start "Internet Explorer"
.Get "http://cvb.manatron.com/Tabs/PropertySearch.aspx"
.FindElementById("fldInput").SendKeys ("Carter")
.FindElementById("btnsearch").Click
sInfo = .FindElementById("grm-search", timeout:=20000).Text
Debug.Print sInfo
.Quit
End With
End Sub
希望有人能帮忙。谢谢
通过在SendKeys
之前添加延迟并尝试检索sInfo
,这对我有用。
Option Explicit
Sub TableData()
Dim driver As New WebDriver
Dim sInfo As String
With driver
.Start "Chrome" '"Internet Explorer"
.Get "http://cvb.manatron.com/Tabs/PropertySearch.aspx"
Application.Wait Now + TimeValue("00:00:02")
.FindElementByCss("#fldInput").SendKeys "Carter"
.FindElementById("btnsearch").Click
Application.Wait Now + TimeValue("00:00:01")
sInfo = .FindElementById("grm-search", timeout:=20000).Text
Debug.Print sInfo
.Quit
End With
End Sub
输出:
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(68条)