Jump to content
superklamer

IE help radio button and drop down menu

Recommended Posts

superklamer

Hi again,

This time I am stuck with checking a radio button and selecting a value from drop down menus. Those IE UDFs are really killing me.

These are the radio buttons I have to check

<input id="regformMan" name="gender" class="radio" type="radio" value="2">

<input id="regformWoman" name="gender" class="radio" type="radio" value="1">

This is what I have came up with for the radio button. I have also tried to capture these with _IEFrameGetObjByName ... no luck

#include <IE.au3>

Local $oIE = _IECreate("website")

Local $oInputs = _IETagNameGetCollection($oIE, "input")
Local $sTxt = ""
For $oInput In $oInputs
    $sTxt &= $oInput.type & @CRLF
MsgBox (0, "", $oInputs)
Sleep(1000)

_IEFormElementRadioSelect($oInputs, 2, "gender", 1, "byIndex")

But as you can guess it's not working. 

And also I have to select values from the following drop down menus:

<select id="regformDay" name="bday" class="customSelect" style="display: none;">
                <option value="0" selected="selected">&nbsp;</option>
                
                    <option value="1">1</option>
                
                    <option value="2">2</option>
                
AND SO ON TO 30
            
            </select>
            

<select id="regformMonth" name="bmonth" class="customSelect" style="display: none;">
                <option value="0" selected="selected">&nbsp;</option>
                <option value="1">January </option>
                <option value="2">February </option>

AND SO ON TO DECEMBER

            </select>
            
            
<select id="regformYear" name="byear" class="customSelect" style="display: none;">
                <option value="0" selected="selected">&nbsp;</option>
                
                    <option value="2001">2001</option>
                
                    <option value="2000">2000</option>
                
AND SO ON UNTIL THE END OF TIME
                
            </select>

I will be registering bulk number of e-mails using CSV files with all the student names and I hate do do this a million times. I figured out pretty much all other fields except these two. 

Can anybody give me a little push as to where I should start looking? 

Thank you guys!

 

Share this post


Link to post
Share on other sites
superklamer

Does anybody know how to click that radio button? 

I am still trying to figure it out.

Share this post


Link to post
Share on other sites
superklamer

so you mean it should look for "regformMan" and "regformWoman"? 

How would that look?

I have 

#include <IE.au3>

Local $oIE = _IECreate("website")

Local $oInputs = _IETagNameGetCollection($oIE, "checkbox")
Local $sTxt = ""
For $oInput In $oInputs
    $sTxt &= $oInput & @CRLF
;MsgBox (0, "", $sTxt)
Sleep(1000)
Next

_IEFormElementRadioSelect($oInputs, 2, "regformMan", 1, "byValue")

And it's not working... It should be so simple, I just can't see it.

 

Or may be this:

#include <IE.au3>

Local $oIE = _IECreate("website")

Local $oInputs = _IETagNameGetCollection($oIE, "input")
Local $sTxt = ""
For $oInput In $oInputs
    $sTxt &= $oInput & @CRLF
;MsgBox (0, "", $sTxt)
Sleep(1000)
Next

_IEFormElementRadioSelect($oInputs, "regformMan", "checkbox", 1, "byValue")

 

Edited by superklamer

Share this post


Link to post
Share on other sites
Danp2

You are calling _IEFormElementRadioSelect with the wrong value for the first parameter (should be a reference to the form object).

​Highlighted the key word for you above.

so you mean it should look for "regformMan" and "regformWoman"? 

How would that look?

You need to get a reference to the form object (check the help file for _IEFormGetObjByName or _IEFormGetCollection. Then you pass this object as the first parameter to _IEFormElementRadioSelect.

 

Share this post


Link to post
Share on other sites
superklamer

 

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate("https://passport.abv.bg/app/profiles/registration")

Local $oForm = _IEFormGetObjByName($oIE, "gender")

_IEFormElementRadioSelect($oForm, then what ???

 

I give up ...

If I put MsgBox to return the $oForm it always returns "0". 

Sorry, Danp2, I don't want you to think you I want you to do it for me, but it's one of those days.

Edited by superklamer

Share this post


Link to post
Share on other sites
Danp2

You're code above should be generating an error, which you need to deal with using some error handling. If you don't successfully find the form, then it doesn't make sense to continue at that point.

FWIW, "gender" is not the form name. It's the name of one of the input fields. You need to figure out the correct name for the form and use that in the _IEFormGetObjByName function call.

Share this post


Link to post
Share on other sites
superklamer

Ok I figured out the radio button and it was pretty easy actually.

Local $oForm = _IEFormGetObjByName($oIE, "registration-form")
    _IEAction($oForm, "focus")
    _IEFormElementRadioSelect($oForm, $lArray3, "gender", 1, "byValue")

I have another question now, how do I select the birthday day, month and year? Those are drop down menus

<input id="settings_day" class="input_box_select" type="text" value="" readonly="readonly" onfocus="DropDownOpen(
                                                    this.parentNode.getElementsByTagName('div')[0],
                                                    'register_select',
                                                    'drop_down_settings_day'
                                                ); HideHint('signup_mail_hint');">

 

<div class="drop_down drop_right" id="drop_down_settings_day" style="left: 289px; top: 389px; width: 106px;">
                                <a class="drop_down_link" href="javascript: void(0);"></a>
                                <div class="drop_down_box" style="height: 309px;">
                                    <ul class="drop_down_list">
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','1');">1</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','2');">2</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','3');">3</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','4');">4</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','5');">5</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','6');">6</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','7');">7</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','8');">8</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','9');">9</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','10');">10</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','11');">11</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','12');">12</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','13');">13</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','14');">14</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','15');">15</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','16');">16</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','17');">17</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','18');">18</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','19');">19</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','20');">20</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','21');">21</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','22');">22</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','23');">23</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','24');">24</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','25');">25</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','26');">26</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','27');">27</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','28');">28</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','29');">29</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','30');">30</li>
                                                                                <li class="drop_down_list_item list_no_icon" onclick="InputSelectValue(this,'settings_day','31');">31</li>
                                                                            </ul>
                                </div>
                                <b class="drop_down_glue" style="width: 34px; display: none;"></b>
                            </div>

I have pasted only the source code for the day since the month and year are the same.

I have tried getting the ObjectIdName for drop_down_settings_day and the class name for drop_down drop_right, but I couldn't get anything back. Any suggestions?

 

Edited by superklamer

Share this post


Link to post
Share on other sites
superklamer

<div class="login_checkbox">
                                            <span class="checkbox" onclick="SettingsCheckbox(this);HideHint('signup_mail_hint');">Съгласен съм с <a href="/terms" target="_blank" onclick="checkBox(this.parentNode);">общите условия</a> <span style="color:red">*</span></span>
                                            <input type="hidden" name="terms" value="0" size="0">
                                        </div>
<div class="login_checkbox">
                                            <span class="checkbox" onclick="SettingsCheckbox(this);HideHint('signup_mail_hint');">Разрешавам личните ми данни да бъдат съхранени и обработвани <span style="color:red">*</span></span>
                                            <input type="hidden" name="allow" value="0" size="0">
                                        </div>

And last I have problems with these two check boxes. Should I identify them by the DIV class "login_checkbox" or by the SPAN class "checkbox"? 

This is how the source changes when the box is checked.

<div class="login_checkbox">
                                            <span class="checkbox checked" onclick="SettingsCheckbox(this);HideHint('signup_mail_hint');">Съгласен съм с <a href="/terms" target="_blank" onclick="checkBox(this.parentNode);">общите условия</a> <span style="color:red">*</span></span>
                                            <input type="hidden" name="terms" value="1" size="0">
                                        </div>
<div class="login_checkbox">
                                            <span class="checkbox checked" onclick="SettingsCheckbox(this);HideHint('signup_mail_hint');">Разрешавам личните ми данни да бъдат съхранени и обработвани <span style="color:red">*</span></span>
                                            <input type="hidden" name="allow" value="1" size="0">
                                        </div>

And this is what I have tried, but it's not working

Local $chek1 = _IETagNameGetCollection($oIE, "login_checkbox")
For $oBut1 In $chek1
    ;MsgBox(0, "test", $oBut1.classname)
    If StringInStr($oBut1.classname, "checkbox") Then
        _IEAction($oBut1, "click")
    EndIf
Next

.

 

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.