Jump to content
Sign in to follow this  

Check all checkboxes on a website

Recommended Posts



I am trying to create a script that will automatically select all checkboxes on a particular website, then click a link on the website (to go to page 2, check all the checkboxes, go to page 3 and so on).

Is there any way to create a script to select the currently open window and find the form elements automatically and select all of them and then click on the link on the page until all of the predefined pages are exhausted?

So in short: click on the script; it prompts you with how many pages you want, to click through, then it click on all the checkboxes within the amount of pages that many times (in a for or while loop).

Any help would be appreciated! - Thank you in advance.

#include <IE.au3>

Dim $oIE, $o_form, $o_checkbox

; Create a browser window and navigate to tool
    $url = "http://www.google.com"
    $oIE = _IECreate ($url, 0, true)
; get pointer to the form
    $o_form = _IEFormGetObjByName ($oIE, "message_form")

; get pointer to the checkbox (this one works and checks it)
    _IEFormElementCheckBoxSelect($o_form, 0, "", 1, "byIndex")
; get pointer to the checkbox (this one does not work - and therefore does not uncheck it)
    _IEFormElementCheckBoxSelect($o_form, "on", "msgTermsUse", 0)

Share this post

Link to post
Share on other sites

Your code is good, but it doesn't go deep enough. _IEFormElementGetObjByName() will be what you need after your call to _IEFormGetObjByName().

Failing that, use a loop and get a collection of TagNames for those checkboxes. Similar in construction to this:

$L_o_Inputs = _IETagNameGetCollection($L_oIE_CRU, "INPUT")
    $L_iInputCnt = @extended
    ConsoleWrite("Debug: Found " & $L_iInputCnt & " input tags" & @LF)
    Local $flagRFC = 0
    If $L_iInputCnt Then
        For $L_oInput In $L_o_Inputs
            If $L_oInput.name = "rfcrAmt"  And $flagRFC < 1 Then
                $L_oInput.value = $strRFCAmt
                ConsoleWrite("Debug: Updated RFCR Amt" & @LF)
                $flagRFC = 1
            If $L_oInput.type = "submit"  And $L_oInput.value = "Update"  Then
                ConsoleWrite("Debug: Found Update button" & @LF)
                _IEAction($L_oInput, "click")

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this