【问题标题】:Click Button on Webpage via VBScript?通过VBScript单击网页上的按钮?
【发布时间】:2011-07-14 15:39:54
【问题描述】:

我正在使用 VBScript 制作一个机器人,它在 Internet Explorer 中打开一个网页并单击一个按钮。我已经打开页面,但我不知道如何单击按钮。我有元素。我想做这样的事情:

browser.Document.All("Button_Name").Click()

【问题讨论】:

  • 没有足够的信息来回答这个问题...您建议的代码是正确的,所以如果这不起作用,如果您需要帮助排除故障,您需要详细说明具体问题。
  • 除了Tmdean,试着查一下GetElementById()GetElementsByName()这两个方法做了什么。它们可能很有用。

标签: button vbscript click bots


【解决方案1】:
'Search Google
Dim objWshShell,IE,searchStr

Set objWshShell = Wscript.CreateObject("Wscript.Shell")
Set IE = CreateObject("InternetExplorer.Application")
searchStr = InputBox("Search")

With IE
  .Visible = True
  .Navigate "http://www.google.com"

'Wait for Browser
  Do While .Busy
    WScript.Sleep 100
  Loop
  .Document.getElementsByName("q").Item(0).Value = searchStr
  .Document.getElementsByName("btnK").Item(0).Click
End With

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-13
    • 1970-01-01
    • 2015-05-21
    • 2010-12-21
    • 1970-01-01
    • 2012-12-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多