vb 怎么去判断 html 对象 是否存在?用nothing null <>""都不成功
' If WebBrowser1.Document.getElementsByName("ItemID")(0).Value <> "" Then
Set is_complete = WebBrowser1.Document.getElementsByName("name")(0)
If Not is_complete Is Nothing Then
MsgBox is_complete
' If WebBrowser1.Document.getElementsByName("name")(0).Value <> "" Then
Debug.Print vbLf
Debug.Print WebBrowser1.Document.getElementsByName("name")(0).Value
Debug.Print "-------------------------"
Debug.Print ccc
end if
很诡异的问题就是 进入了 if 语句后 Debug.Print WebBrowser1.Document.getElementsByName("name")(0).Value 这个语句居然输出为空了,就是 Not is_complete Is Nothing 这个是 true的 ,然后我测试过 用 is null <>""来判断都是一样的结果,第一行被注释的语句也一样测试过,结果一样,获取的对象 msgbox 输出是 object htmlinputelement ,就是 有时候 获取值的时候 网页加载不完全,会导致 get不到 对象,然后报错,所以想通过这个 语句先判断下是否加载完全。但是网上的方法 都测试了,也一样,判断不为空了,结果 还是 获取不到值,请大侠指教一下?谢谢