2016-11-04 250 views
0

我點擊一個按鈕時遇到了一些問題。我試圖解決過去5個小時的問題,最後得出結論在這裏提出。AutoIT |瀏覽器|點擊一個按鈕

我試圖點擊的按鈕被稱爲「like」。它在這裏的代碼中。

代碼有什麼問題?

#include <ButtonConstants.au3> 
#include <EditConstants.au3> 
#include <GUIConstantsEx.au3> 
#include <StaticConstants.au3> 
#include <WindowsConstants.au3> 
#include <ie.au3> 
#include <MsgBoxConstants.au3> 
#include <GuiEdit.au3> 
#Region ### START Koda GUI section ### Form= 
$Form1 = GUICreate("KingDomLikes Bot", 334, 150, 192, 124) 
$Group1 = GUICtrlCreateGroup("Login", 0, 0, 137, 145) 
$username = GUICtrlCreateInput("Username", 8, 32, 121, 21) 
$password = GUICtrlCreateInput("Password", 8, 64, 121, 21) 
$Login1 = GUICtrlCreateButton("Login", 8, 96, 123, 25) 
GUICtrlCreateGroup("", -99, -99, 1, 1) 
$Group2 = GUICtrlCreateGroup("", 144, 0, 185, 145) 
$repeat = GUICtrlCreateInput("0", 152, 32, 121, 21) 
$Label1 = GUICtrlCreateLabel("Loop", 152, 16, 28, 17) 
$start = GUICtrlCreateButton("Start", 152, 64, 163, 73) 
GUICtrlCreateGroup("", -99, -99, 1, 1) 
GUISetState(@SW_SHOW) 
#EndRegion ### END Koda GUI section ### 
logintosite() 

Func logintosite() 
While 1 
    $nMsg = GUIGetMsg() 
    Switch $nMsg 
     Case $GUI_EVENT_CLOSE 
      Exit 

     Case $Login1 
      Global $oIE = _IECreate("http://addmefast.com/") 

      $username1 = GUICtrlRead($username) 
      $password1 = GUICtrlRead($password) 

      $emailform = _IEGetObjByName($oIE, "email") 
      $usernameform = _IEGetObjByName($oIE, "password") 
      $buttonweb = _IEGetObjByName($oIE, "login_button") 




      _IEFormElementSetValue($emailform, $username1) 
      _IEFormElementSetValue($usernameform, $password1) 
      _IEAction($buttonweb, "click") 

      Case $start 
       _IENavigate($oIE, "http://addmefast.com/free_points/youtube_likes") 
       sleep(2000) 
       For $i = 1 To $repeat 
        _IET ($oIE, "Like") 

       Next 

    EndSwitch 
WEnd 
EndFunc 

我已經嘗試了許多不同的解決方案,我在網上找到了,但沒有一個真的有效。

+0

請刪除無用的標籤'記錄/ login',或至少爲您正在使用的實際編程語言或系統添加相關標籤。 –

+0

謝謝你的提示。我添加了一些標籤。 –

回答

0

_IENavigate(ByRef$oObject$sUrl [,$iWait = 1])

你缺少你_IENavigate調用對象的參數。

應該是這樣的:

_IENavigate($ OIE, 「http://addmefast.com/free_points/youtube_likes」)

工作代碼:

#include <ButtonConstants.au3> 
#include <EditConstants.au3> 
#include <GUIConstantsEx.au3> 
#include <StaticConstants.au3> 
#include <WindowsConstants.au3> 
#include <ie.au3> 
#include <MsgBoxConstants.au3> 
#include <GuiEdit.au3> 
#Region ### START Koda GUI section ### Form= 
$Form1 = GUICreate("KingDomLikes Bot", 334, 150, 192, 124) 
$Group1 = GUICtrlCreateGroup("Login", 0, 0, 137, 145) 
$username = GUICtrlCreateInput("Username", 8, 32, 121, 21) 
$password = GUICtrlCreateInput("Password", 8, 64, 121, 21) 
$Login1 = GUICtrlCreateButton("Login", 8, 96, 123, 25) 
GUICtrlCreateGroup("", -99, -99, 1, 1) 
$Group2 = GUICtrlCreateGroup("", 144, 0, 185, 145) 
$repeat = GUICtrlCreateInput("0", 152, 32, 121, 21) 
$Label1 = GUICtrlCreateLabel("Loop", 152, 16, 28, 17) 
$start = GUICtrlCreateButton("Start", 152, 64, 163, 73) 
GUICtrlCreateGroup("", -99, -99, 1, 1) 
GUISetState(@SW_SHOW) 
#EndRegion ### END Koda GUI section ### 
logintosite() 

Func logintosite() 
While 1 
    $nMsg = GUIGetMsg() 
    Switch $nMsg 
     Case $GUI_EVENT_CLOSE 
      Exit 

     Case $Login1 
      Global $oIE = _IECreate("http://addmefast.com/") 

      $username1 = GUICtrlRead($username) 
      $password1 = GUICtrlRead($password) 

      $emailform = _IEGetObjByName($oIE, "email") 
      $usernameform = _IEGetObjByName($oIE, "password") 
      $buttonweb = _IEGetObjByName($oIE, "login_button") 

      _IEFormElementSetValue($emailform, $username1) 
      _IEFormElementSetValue($usernameform, $password1) 
      _IEAction($buttonweb, "click") 

      Case $start 
       _IENavigate($oIE, "http://addmefast.com/free_points/youtube_likes") 

    EndSwitch 
WEnd 
EndFunc 
相關問題