VB WebBrowser 自动登录阿里妈妈 请高手指导

阿菜321 2013-12-25 02:59:48
我是小白,调试半天不成功,望高人指导一二。代码如下:
Private Sub Command2_Click()
WebBrowser1.Document.All("TPL_username_1")(0).Value = "用户名"
WebBrowser1.Document.All("TPL_password_1")(0).Value = "密码"
WebBrowser1.Document.All("J_SubmitStatic").Click ''登陆

End Sub
Private Sub Form_Load()
Command2.Enabled = False
WebBrowser1.Navigate2 "http://www.alimama.com/member/login.htm?spm=0.0.0.0.OA4g9o&forward=http://u.alimama.com"
End Sub
Private Sub Form_Resize()
On Error Resume Next
WebBrowser1.Move 50, WebBrowser1.Top, Me.ScaleWidth - 100, Me.ScaleHeight - WebBrowser1.Top
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If URL <> "about:blank" And URL <> "" And URL <> "http:'/" Then
Command2.Enabled = True
End If
End Sub
...全文
246 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
一如既往哈 2013-12-28
  • 打赏
  • 举报
回复
引用 2 楼 u012627425 的回复:
[quote=引用 1 楼 Topc008 的回复:]
WebBrowser1.Document.All("TPL_username_1")(0).Value = "用户名"
WebBrowser1.Document.All("TPL_password_1")(0).Value = "密码"
你的内容能输进去吗
没反应啊,还请指教一二……[/quote] 直接用下面代码试试:前提是TPL_username_1和TPL_password_1是input元素的id
WebBrowser1.Document.All.Item("TPL_username_1").Value = "用户名"
WebBrowser1.Document.All.Item("TPL_password_1").Value = "密码"
阿菜321 2013-12-28
  • 打赏
  • 举报
回复
引用 1 楼 Topc008 的回复:
WebBrowser1.Document.All("TPL_username_1")(0).Value = "用户名"
WebBrowser1.Document.All("TPL_password_1")(0).Value = "密码"
你的内容能输进去吗
没反应啊,还请指教一二……
一如既往哈 2013-12-25
  • 打赏
  • 举报
回复
WebBrowser1.Document.All("TPL_username_1")(0).Value = "用户名"
WebBrowser1.Document.All("TPL_password_1")(0).Value = "密码"
你的内容能输进去吗

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧