尝试通过VBS在网页中自动登录

时间:2016-10-08 14:12:29

标签: html vbscript

登录页面

enter image description here

HTML代码

<ul class="login_screen_mask">
   <li><label for="username">Username:</label><input tabindex="1" type="text" autocapitalize="off" autocorrect="off" style="font-family: sans-serif; font-size: 12px; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255); border: 1px solid rgb(51, 51, 51); margin: 0px; padding: 1px; opacity: 0.99;"></li>
   <li><label for="password">Password:</label><input tabindex="2" type="password" style="font-family: sans-serif; font-size: 12px; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255); border: 1px solid rgb(51, 51, 51); margin: 0px; padding: 1px; opacity: 0.99;"></li>
   <li>
      <div><input type="checkbox" style="width: 20px; border-width: 0px; opacity: 0.99;"><span>Remember my login (uses cookie)</span></div>
   </li>
</ul>

这是登录页面的代码,其中给出了用户名和密码,但是与输入标记链接。该标签也没有id所以我需要去“login_screen_mask”类并搜索用户名和passoword的输入标签。我能够搜索所有内容,但无法在该输入框中插入值。请帮忙!

1 个答案:

答案 0 :(得分:0)

  1. 设置objIE = MyBrowser.document
  2. 对于每个元素在objIE.getElementsByClassName(“login_screen_mask”)
  3. 如果ELEMENT.className =“login_screen_mask”那么
  4. MsgBox(ELEMENT.innerHTML)
  5. 对于每个ELEMENT1在ELEMENT.all
  6. 如果ELEMENT1.tagName =“INPUT”那么
  7. ELEMENT1.setAttribute ////我应该放什么值
  8. MsgBox(ELEMENT1.outerHTML)enter code here
相关问题