Sign in to follow this  
Followers 0
rony2006

Select checkbox in IE

1 post in this topic

Hello, I am trying to get selected all checkboxs in this site: http://www.cenace.gob.mx/SIM/VISTA/REPORTES/PreEnergiaSisMEM.aspx

 

First I got the element list that are in the area of checkboxs:

 

<table id="ContentPlaceHolder1_Table2" style="width: 100%;">
        <tbody><tr>
            <td valign="top" style="border: 1px solid dimgray; width: 260px;"><div class="RadTreeView RadTreeView_Default" id="ctl00_ContentPlaceHolder1_treePrincipal" style="width: 260px; height: 540px; overflow: auto;">
                <!-- 2014.2.724.45 --><ul class="rtUL rtLines">
                    <li class="rtLI rtFirst rtLast"><div class="rtTop">
                        <span class="rtSp"></span><span class="rtMinus"></span><span class="rtUnchecked"></span><span class="rtIn colorRojo">Precios de la energía</span>
                    </div><ul class="rtUL">
                        <li class="rtLI"><div class="rtTop">
                            <span class="rtSp"></span><span class="rtMinus"></span><span class="rtUnchecked"></span><img class="rtImg" alt="" src="/SIM/VISTA/img/open_folder.png"><span class="rtIn colorVerde">Precios Marginales Locales</span>
                        </div><ul class="rtUL">
                            <li class="rtLI"><div class="rtTop">
                                <span class="rtSp"></span><span class="rtMinus"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">MDA</span>
                            </div><ul class="rtUL">
                                <li class="rtLI"><div class="rtTop">
                                    <span class="rtSp"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">Diarios</span>
                                </div></li><li class="rtLI rtLast"><div class="rtBot">
                                    <span class="rtSp"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">Mensuales</span>
                                </div></li>
                            </ul></li><li class="rtLI rtLast"><div class="rtBot">
                                <span class="rtSp"></span><span class="rtMinus"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">MTR</span>
                            </div><ul class="rtUL">
                                <li class="rtLI"><div class="rtTop">
                                    <span class="rtSp"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">Diarios</span>
                                </div></li><li class="rtLI rtLast"><div class="rtBot">
                                    <span class="rtSp"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">Mensuales</span>
                                </div></li>
                            </ul></li>
                        </ul></li><li class="rtLI rtLast"><div class="rtBot">
                            <span class="rtSp"></span><span class="rtMinus"></span><span class="rtUnchecked"></span><img class="rtImg" alt="" src="/SIM/VISTA/img/open_folder.png"><span class="rtIn colorVerde">Precios de Nodos Distribuidos</span>
                        </div><ul class="rtUL">
                            <li class="rtLI"><div class="rtTop">
                                <span class="rtSp"></span><span class="rtMinus"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">MDA</span>
                            </div><ul class="rtUL">
                                <li class="rtLI"><div class="rtTop">
                                    <span class="rtSp"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">Diarios</span>
                                </div></li><li class="rtLI rtLast"><div class="rtBot">
                                    <span class="rtSp"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">Mensuales</span>
                                </div></li>
                            </ul></li><li class="rtLI rtLast"><div class="rtBot">
                                <span class="rtSp"></span><span class="rtMinus"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">MTR</span>
                            </div><ul class="rtUL">
                                <li class="rtLI"><div class="rtTop">
                                    <span class="rtSp"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">Diarios</span>
                                </div></li><li class="rtLI rtLast"><div class="rtBot">
                                    <span class="rtSp"></span><span class="rtUnchecked"></span><span class="rtIn cssNodos">Mensuales</span>
                                </div></li>
                            </ul></li>
                        </ul></li>
                    </ul></li>
                </ul><input name="ctl00_ContentPlaceHolder1_treePrincipal_ClientState" id="ctl00_ContentPlaceHolder1_treePrincipal_ClientState" type="hidden">
            </div></td><td> &nbsp;
                    </td><td valign="top" style="border: 1px solid dimgray;">

                        <div style="width: auto; height: 500px; overflow: scroll;">

 

Then I tried the following code:

#include <IE.au3>

$sURL = "http://www.cenace.gob.mx/SIM/VISTA/REPORTES/PreEnergiaSisMEM.aspx"
$oIE = _IECreate ($sURL, 1)

$oCheckBox = _IEGetObjByName($oIE, "rtUnchecked")

If Not $oCheckBox.checked Then
    $oCheckBox.checked = True
    $oCheckBox.fireEvent ("onclick")
EndIf

which is not working.

Sometimes the page needs a refresh to be able to display the checkboxes.

Is there a way to make this to work?

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  
Followers 0