网页抓取自动登录vb

时间:2018-05-02 09:56:45

标签: html vba web web-scraping

以下vb代码尝试登录网站:

Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLElement As MSHTML.IHTMLElement

IE.Visible = True

IE.navigate ("https://www.website.com/login")
Do While IE.ReadyState <> READYSTATE_COMPLETE: Loop
Set HTMLDoc = IE.Document

HTMLDoc.all("loginForm-email").Value = "email@address.com"
HTMLDoc.all("loginForm-password").Value = "password"
HTMLDoc.all("loginForm-submit").Click

电子邮件地址和密码在网页上正确显示,但是当按下登录按钮时,错误就好像没有输入数据一样,这是因为有一些验证它没有被vb脚本触发。

我注意到某些“IHTMLElement”的属性默认设置为:

"has-feedback form-group has-error pristine untouched ember-view"

...并且在输入电子邮件时更改了密码手动,到:

"has-feedback form-group has-success pristine touched ember-view"

....但是上面的vb脚本没有改变?

任何想法都是最受欢迎的。

0 个答案:

没有答案
相关问题