fupsky 发表于 2014-5-22 16:38:41

如何点击按钮,进行搜索呢?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>


Local $oIE = _IECreateEmbedded()
GUICreate("Embedded Web control Test", 640, 580, _
      (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
      $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
GUICtrlCreateObj($oIE, 10, 40, 600, 360)
Local $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
Local $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
Local $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Local $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)
Local $GUI_Button_Search = GUICtrlCreateButton("搜索并获取数值", 450, 420, 100, 30)
GUISetState() ;显示GUI

_IENavigate($oIE, "http://www.baidu.com")




$oForm = _IEFormGetObjByName ($oIE, "f1") ;指定form名称
$oText = _IEFormElementGetObjByName ($oForm, "wd");将要获取的表单名称
$a=_IEFormElementGetValue ($oText)


; 等待用户关闭窗口
While 1
        Local $msg = GUIGetMsg()
    Select
      Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
      Case $msg = $GUI_Button_Home
            _IENavigate($oIE, "http://www.baidu.com")
      Case $msg = $GUI_Button_Back
            _IEAction($oIE, "back")
      Case $msg = $GUI_Button_Forward
            _IEAction($oIE, "forward")
      Case $msg = $GUI_Button_Stop
            _IEAction($oIE, "stop")
                Case $msg = $GUI_Button_Search
                        _IEAction($oIE, "click")
    EndSelect
WEnd

GUIDelete()

Exit我想在搜索框输入数值后,点击$gui_button_search就可以点击搜索,请问高人,如何解决?


如何用$oForm = _IEFormGetObjByName ($oIE, "f1") ;指定form名称
$oText = _IEFormElementGetObjByName ($oForm, "wd");将要获取的表单名称
$a=_IEFormElementGetValue ($oText)

lixiaolong 发表于 2014-5-22 20:14:32

回复 1# fupsky                 Case $msg = $GUI_Button_Search
                $Ele = _IEGetObjById($oIE, "su1")
                _IEAction($Ele, "click")<input class="bg s_btn" id="su1" onmouseout="this.className='bg s_btn'" onmousedown="this.className='bg s_btn s_btn_h'" type="submit" value="百度一下">

lixiaolong 发表于 2014-5-22 20:20:53

风行者前辈的【网页快捕】

fupsky 发表于 2014-5-23 16:10:29

谢谢各位,换了一种思路,解决了
页: [1]
查看完整版本: 如何点击按钮,进行搜索呢?