Abierle Posted August 29, 2006 Posted August 29, 2006 (edited) Hi folks! I got this source code from an example page. There are to Dropdown fields and one Checkbox. I have to select something in BOTH dropdown fields an i have to check the checkbox. I tried my luck with ie.au3 and i managed to fill in the input fields but i just can't get my script to check the checkbox and choose stuff out of the dropdown boxes. This is the code i tried: $oIE3 = _IECreate ( "http://testpage/", 0, 1, 1, 1 ) WinSetState ( "testpage", "", @SW_MAXIMIZE ) $oForm = _IEFormGetObjByName ( $oIE3, "f" ) $oQuery = _IEFormElementGetObjByName ( $oForm, "From1" ) _IEFormElementSetValue ( $oQuery, "c" ) $oQuery = _IEFormElementGetObjByName ( $oForm, "From2" ) _IEFormElementSetValue ( $oQuery, "testtest" ) $oQuery = _IEFormElementGetObjByName ( $oForm, "To1" ) _IEFormElementSetValue ( $oQuery, "f" ) $oQuery = _IEFormElementGetObjByName ( $oForm, "To2" ) _IEFormElementSetValue ( $oQuery, "test2test2" ) _IEFormElementCheckBoxSelect ( $oForm, "checkbox1", "", 1, "byValue" ) _IEFormSubmit ($oForm) This is the sourcecode of the page: <form action=./ method=POST name=f><input type=hidden name=p value=1> <input type=hidden name=iframe value=""> <table border=0 bgcolor=#DEDEDE><tr><td>From</td> <td><select name=From1> <option>a<option>b<option>c<option>d<option>e<option>f<option>g<option>h<option>i<option>j <option>k<option>l<option>m<option>n<option>o<option>p<option>q<option>r<option>s<option>t <option>u<option>v<option>w<option>x<option>y<option>z</select>/<input type=text name=From2 maxlength=8 size=9 id="from"></td></tr> <tr><td>To</td> <td><select name=To1> <option>a<option>b<option>c<option>d<option>e<option>f<option>g<option>h<option>i<option>j <option>k<option>l<option>m<option>n<option>o<option>p<option>q<option>r<option>s<option>t <option>u<option>v<option>w<option>x<option>y<option>z</select>/<input type=text name=To2 maxlength=8 size=9 id="sometext"></td></tr> <tr><td colspan=2>Text:<br> <textarea rows=5 cols=50 name=Text onchange=check(); onkeyup=check(); id="nachricht"></textarea><br /> <input type=text name=Rest readonly size=4 value=160> Zeichen verbleiben</td></tr> <td colspan=2><input type=checkbox name=checkbox1 value=1> check it </td></tr> </table><br><input type=submit value="test!" class="submitbutton"> I tried the script like this and it doesn't check the checkbox nor does it select anything out of these two dropdown-boxes... Edited August 29, 2006 by Abierle
Moderators big_daddy Posted August 30, 2006 Moderators Posted August 30, 2006 This should give you something to work with. #include <IE.au3> $sURL = "http://testpage/" $oIE = _IECreate($sURL, 0, 1, 0) WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE) _IELoadWait($oIE) $oForm = _IEFormGetObjByName($oIE, "f") $oSelectFrom = _IEFormElementGetObjByName($oForm, "From1") $oSelectTo = _IEFormElementGetObjByName($oForm, "To1") For $i = 0 To $oSelectFrom.length - 1 _IEFormElementOptionselect($oSelectFrom, $i, 1, "byIndex") Sleep(100) Next For $i = 0 To $oSelectTo.length - 1 _IEFormElementOptionselect($oSelectTo, $i, 1, "byIndex") Sleep(100) Next _IEFormElementCheckBoxSelect ($oForm, "1")
Moderators big_daddy Posted August 30, 2006 Moderators Posted August 30, 2006 No problem, glad I was able to help.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now