关于大小写
使用内置DOM最大的坑是大小写问题,来自DOM的属性和函数,起大小写必须和DOM保持一致:
以上一节的代码为例,如果你写成:
'''Async
Dim
wv
As
WebViewer = e.Form.Controls("WebViewer1").WebViewer
Dim
changePages = wv.querySelectorAll("a.changePage")
Dim
count
As
Integer
=
Await
changePages.length
For
i
As
Integer
= 0
To
count - 1
Dim
txt
As
String
=
Await
changePages(i).Text
If
txt.Trim("""")
=
"下一页"
Then
'如果这个命令是下一页
changePages(i).click()
'模拟单击下一页
End
If
Next
那么代码是不会成功执行的,问题出在这一行:
Dim
txt
As
String
=
Await
changePages(i).Text
text属性必须是小写才行:
Dim
txt
As
String
=
Await
changePages(i).text