Jump to content
Sign in to follow this  
sketchin

Clicking OnClick Links in Div

Recommended Posts

sketchin

Alright, so I am just getting into AutoIT and honestly I am loving it so far.

First project was going to be a program to automatically log me into my game account, click the vote page and click the links so I can vote. I seemed to have come across 2 problems and it seems no matter how much I google possible solutions I cannot come up with the answer.

1. I am unable to click these specific links on a page, I got the View Source and the Inspect element, but they share the same ID's and when I plug 1 of them into the source it cannot find it so I am utterly confused about this, links to both will be provided.

2. I am wondering how you click a pre-existing tab in IE since the links I click open a new tab, I need it to select the previous tab to click the other 2 links as well.

#include <IE.au3>

Call ("signIn")

Func signIn ()
    Global $oIE = _IECreate ("www.molten-wow.com/login/")
Sleep(5000)
;Variables for Molten Web Page
    Local $username = _IEGetObjByName ($oIE, "strID");Username Field
    Local $password = _IEGetObjByName ($oIE, "strPW");Password Field
    Local $button = _IEGetObjByID ($oIE, "checkBtn");Login Button


;Actions Set by Me
    _IEFormElementSetValue ($username,"USERNAME");Enter Username
    _IEFormElementSetValue ($password,"PASSWORD");Enter Password
    _IEAction ($button, "click");Click Obj Password Button
Sleep(1000)
_IENavigate($oIE, "https://www.molten-wow.com/account/#1:1:0:0:0")
Sleep(2000))

EndFunc

The Elements in which I am trying to click

<tr>
                    <td>
                            <form id="vform1" action="/account/vote/" method="post" target="_blank">
                            <input name="id" type="hidden" value="1">
                            <div class="cpBtn" style="width: 95px; height: 38px;" onclick="document.getElementById('vform1').submit();">
                                <p style="margin: 11px auto;">Open WoW</p>
                            </div>
                            </form>
                        </td><td>
                            <form id="vform2" action="/account/vote/" method="post" target="_blank">
                            <input name="id" type="hidden" value="2">
                            <div class="cpBtn" style="width: 95px; height: 38px;" onclick="document.getElementById('vform2').submit();">
                                <p style="margin: 11px auto;">XtremeTop100</p>
                            </div>
                            </form>
                        </td><td>
                            <form id="vform3" action="/account/vote/" method="post" target="_blank">
                            <input name="id" type="hidden" value="3">
                            <div class="cpBtn" style="width: 95px; height: 38px;" onclick="document.getElementById('vform3').submit();">
                                <p style="margin: 11px auto;">ArenaTop100</p>
                            </div>
                            </form>
                        </td>
                </tr>

EDIT:

I just checked out the view source of it and it doesn't show the buttons at all so I am guessing its loading via javascript which is why autoit cannot detect it. I am curious if there is a way of making the mouse click on the general location of the div? Still working out all the kinks here and boy is there alot of them so far.

Edited by sketchin

Share this post


Link to post
Share on other sites
Palestinian

seemed to have come across 3 problems not 2, your 1st problem was not reading the rules of the forums mate, you won't get any help in this area (gaming), its against the rules.

Share this post


Link to post
Share on other sites
Melba23

sketchin,

Palestinian is quite right - please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. Thread locked. :naughty:

But welcome to the AutoIt forum - and see you soon with a legitimate question I hope. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×