Jump to content

Trying to click website button


 Share

Recommended Posts

Have been having some serious issues with clicking a website button.  I have eventually tried to even call for pixel of the button and then click, but still not working.  I would ideally like to get the element of the button and click it that way above all else, but can't find out how/don't know.  The element doesn't have an ID and trying to get by class or tag is not working.  This is the element in question

<div class="button small"><a class="btn-login" href="#">Login</a></div>

 

Any help would be amazing. Below is my current script

$ie = ObjCreate("InternetExplorer.Application")
AutoItSetOption ("MouseCoordMode", 0)
Opt('SendKeyDelay', Random (16,80)); default 5. higher number = slower
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>
#include <WinHttp.au3>
#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <WinAPIFiles.au3>

#Region ### START Koda GUI section ### Form=c:\users\jammmesss\desktop\autoit\login.kxf
Global $nameInfo = IniRead('Userinfo.ini', 'Name', 'Name', 'No username on file')
Global $passInfo = IniRead('Userinfo.ini', 'Pass', 'Pass', 'No password on file')
Global $Login = GUICreate("Login", 244, 162, 483, 309)
GUISetBkColor(0xA0A0A0)
Global $Username = GUICtrlCreateInput($nameInfo, 8, 32, 105, 21)
GUICtrlSetBkColor(-1, 0xFFFFFF)
Global $Password = GUICtrlCreateInput($passInfo, 128, 32, 105, 21)
GUICtrlSetBkColor(-1, 0xFFFFFF)
Global $logBtn = GUICtrlCreateButton("Login", 16, 120, 75, 33)
GUICtrlSetBkColor(-1, 0xFFFFFF)
Global $UserT = GUICtrlCreateLabel("User name", 24, 8, 55, 17)
Global $PassT = GUICtrlCreateLabel("Password", 152, 8, 50, 17)
Global $saveBtn = GUICtrlCreateButton("Save Info", 152, 120, 75, 33)
GUICtrlSetBkColor(-1, 0xFFFFFF)
Global $WorldT = GUICtrlCreateLabel("World", 104, 56, 32, 17)
Global $WorldMen = GUICtrlCreateCombo("92", 88, 80, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
   ; Add additional items to the combobox.
    GUICtrlSetData($WorldMen, "91|90|89|88")
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)

Global $slpMed = Random (2000, 2500)
Global $slpLow = Random (100, 350)
Global $pWorld = GUICtrlRead ($WorldMen)

#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $saveBtn
            $User = GUICtrlRead($Username)
            IniWrite("Userinfo.ini", "Name", "Name", $User)
            $Pass = GUICtrlRead ($Password)
            IniWrite("Userinfo.ini", "Pass", "Pass", $Pass)
        Case $logBtn

            $User = GUICtrlRead($Username)
            $Pass = GUICtrlRead ($Password)
            With $ie
                .visible = True
                WinActivate ($ie)
                .navigate ("*********t")
                While ($ie.busy)
                WEnd
                Sleep ($slpLow)

                $txtUser = .document.getElementById('user')
                $txtUser.value = $User
                Sleep ($slpLow)
                $txtPass = .document.getElementById('password')
                $txtPass.value = $Pass
                Sleep ($slpMed)

                Call (SearchForColor)

            EndWith
    EndSwitch
WEnd

Func SearchForColor ()
                $left = 724
                $top = 421
                $right = 767
                $bottom = 432
                $color = 0x9C006F
                $pixLog = PixelSearch($left, $top, $right, $bottom, $color, 20)
                If not (@error) Then
                    MouseClick('left',$pixLog[0],$pixLog[1],2,1)
                Else
                    MsgBox(0,"Error","There has been an error with $pixLog")
                EndIf
                EndFunc

 

Link to comment
Share on other sites

fghdg

<form id="login_form" action="#" method="post"> <input type="submit" class="submit" id="login_submit_button"> <label for="user"> <input id="user" name="username" type="text" value=""> <span>User name:</span> </label> <label for="password"> <input name="clear" type="hidden" value="true"> <input id="password" name="password" type="password"> <span>Password:</span> </label> <label for="remember-me" class="remember_me"> <span class="remember-me">Remember me</span> <input id="remember-me" type="checkbox" name="remember-me" > </label> <div class="login-buttons"> <a class="login-facebook" href="https://ipp-facebook.******.de/?game=*****e&******t=en&ref=start&"></a> <div class="button small"><a class="btn-login" href="#">Login</a></div> </div> </form>

 

Link to comment
Share on other sites

  • Developers
3 minutes ago, IamKJ said:

/?game=

Seems you have missed our forum rules which explicitly prohibit game automation discussions.
Please take the opportunity now to read them.

Jos 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...