2016-11-04 222 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 
相关问题