2016-11-05 15 views
0

私はウェブサイト上の特定のボタンをクリックしようとしています。私は最終的にここで助けを求めると結論づけました。AutoIT | Divボタンをクリック|ブラウザ

この私の全体のプログラム:

#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 
        Local $oInputs = _IETagNameGetCollection($oIE, "div") 
        For $oInput In $oInputs 
        If $oInput.classname == "btn3" Then _IEAction($oInput, "click") 
        Next 

       Next 

    EndSwitch 
WEnd 
EndFunc 

それはイムボタンをクリックしようとすると、コードの末尾にあります。ボタンには名前やIDはありません。

私はあなたたちはより良い私を助けることができるようにするためのアカウント作成しました:クリック、123456789auto

あなたはサイトにログインすると: ウェブサイト:http://http://addmefast.com/ メール:[email protected] パスワードをyoutubeで左に好きです。今、likeと呼ばれるボタンが表示されます。クリックするにはどうすればいいですか?

もう1つのdiv(「サイトを追加」)が既に存在するため、これは機能しません。

ありがとうございます!

+1

に[のAutoItの可能性の重複をクリックします|ボタン(div)をクリック](http://stackoverflow.com/questions/40432568/autoit-click-a-button-div) – Samoth

答えて

0

をクリックするだけで、あなたのループを交換してください:

  For $a In _IETagNameGetCollection($oIE, "a") 
       If StringInStr(_IEPropertyGet($a, "innerText"), "Like") Then 
        For $i = 1 To $repeat 
         $a.fireEvent("onmousedown") 
         $a.fireEvent("onmouseup") 
         _IEAction($a, "click") 
         _IELoadWait($oIE) 
        Next 
       EndIf 
      Next 

そして、それは何か...

関連する問題