【问题标题】:How to click a button in web page using VB?如何使用VB点击网页中的按钮?
【发布时间】:2016-01-05 13:27:55
【问题描述】:

我正在创建一个单击网页上的按钮的 VB 脚本。我在他们提交表单的地方看到了诸如this 之类的答案。我不希望这样,因为我需要使用脚本单击按钮,以便执行通常的单击按钮工作流程。

顺便说一句,我使用的是 GWT 和 SmartClient,这使得它变得更加复杂,因为 ID 被混淆了。为了克服这个问题,我使用了 GWT DEBUG_ID_PREFIX

【问题讨论】:

    标签: vb.net gwt vbscript


    【解决方案1】:

    如果您能提供一个 GWT 按钮示例,以便像我这样不熟悉 GWT 的人获得帮助,那就太好了。我找到了一个包含 GWT 按钮(希望)的页面,并在此基础上编写了一些内容。
    考虑以下代码。

    Sub WaitUntil(varObj)
        On Error Resume Next
        Do
            WScript.Sleep 100
        Loop Until Not varObj Is Nothing
        WScript.Sleep 500
    End Sub
    
    Dim IE
    Set IE = CreateObject("InternetExplorer.Application")
        IE.Visible = True
        IE.Navigate "http://gwt.google.com/samples/Showcase/Showcase.html#!CwBasicButton"
        WScript.Sleep 500
        WaitUntil IE.Document 'wait until the document is ready
        WaitUntil IE.Document.getElementById("gwt-debug-cwBasicButton-normal") 'wait until the button is initialized
        Dim theButton
        Set theButton = IE.Document.getElementById("gwt-debug-cwBasicButton-normal")
            theButton.Click
            'theButton.fireEvent "onclick" 'another way
    Set IE = Nothing
    

    【讨论】:

      猜你喜欢
      • 2012-01-28
      • 2018-03-26
      • 1970-01-01
      • 2019-11-14
      • 2012-01-28
      • 2011-03-27
      • 2018-12-22
      • 2015-03-08
      • 1970-01-01
      相关资源
      最近更新 更多