dprski33 Posted January 1, 2008 Share Posted January 1, 2008 I have a situation where I need to check a checkbox. Unlike most of the other posts on this topic, this checkbox is NOT part of a form. There are no <form>...</form> tags present. Instead, javascript is used to "submit" the page after the checkbox is checked. Here is a sample of the code I'm working with: filename.txt <input type="checkbox" name="chk5" value="filename.txt|Demo1|demo2"> The checkbox name and value are dynamically generated, based on the filename and how many other files are already present. Based on the filename, I can always figure out the checkbox value, but not necessarily the name. Since this checkbox is not part of a form, I cannot use _IEFormElementCheckBoxSelect to check it. And since I cannot guess the checkbox name, I cannot use _IEGetObjByName. Here's what I need: A way to check this checkbox (and only this checkbox since there may be others) when this page is loaded without using _IEFormElementCheckBoxSelect or _IEGetObjByName Thanks for the help, ~D Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 1, 2008 Share Posted January 1, 2008 (edited) I have a situation where I need to check a checkbox. Unlike most of the other posts on this topic, this checkbox is NOT part of a form. There are no <form>...</form> tags present. Instead, javascript is used to "submit" the page after the checkbox is checked. Here is a sample of the code I'm working with: filename.txt <input type="checkbox" name="chk5" value="filename.txt|Demo1|demo2"> The checkbox name and value are dynamically generated, based on the filename and how many other files are already present. Based on the filename, I can always figure out the checkbox value, but not necessarily the name. Since this checkbox is not part of a form, I cannot use _IEFormElementCheckBoxSelect to check it. And since I cannot guess the checkbox name, I cannot use _IEGetObjByName. Here's what I need: A way to check this checkbox (and only this checkbox since there may be others) when this page is loaded without using _IEFormElementCheckBoxSelect or _IEGetObjByName Thanks for the help, ~D You should still be able to find it by Tag: #include <IE.au3> ; ... $oIE = your IE instance $sFile = "filename.txt" $colInput = _IETagNameGetCollection($oIE, "input") $iInputCnt = @extended ConsoleWrite("Debug: There are " & $iInputCnt & " input tag elements." & @LF) $i = 0 For $oInput In $colInput If $oInput.type = "checkbox" Then ConsoleWrite("Debug: input " & $i & " type = checkbox" & @LF) If StringInStr($oInput.value, $sFile) Then ConsoleWrite("Debug: input " & $i & " value contains " & $sFile & @LF) _IEFormElementCheckBoxSelect($oInput, $sFile) ExitLoop EndIf Else ConsoleWrite("Debug: input " & $i & " type is not checkbox" & @LF) EndIf $i += 1 Next Edited January 1, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
dprski33 Posted January 2, 2008 Author Share Posted January 2, 2008 That worked great. Thanks for your help. ~D Link to comment Share on other sites More sharing options...
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