sun Posted November 8, 2010 Share Posted November 8, 2010 Hi, I want to check a checkbox of table in IE. I don't come accorss my mind how to script check the checkbox. The related html is as following. <tbody class="yui-dt-data" tabindex="0" style=""> <tr id="yui-rec0" class="yui-dt-first yui-dt-even" style=""> <td class="yui-dt0-col-check yui-dt-col-check yui-dt-first" headers="yui-dt0-th-check"> <div class="yui-dt-liner"> <input class="yui-dt-checkbox" "type="checkbox"> <===Plz help how to script this checkbox </div> Link to comment Share on other sites More sharing options...
water Posted November 8, 2010 Share Posted November 8, 2010 AutoIT has an UDF (User Defined Functions) for IE (see the help file). Maybe function _IEFormElementCheckBoxSelect does what you need? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
IndyUK Posted November 8, 2010 Share Posted November 8, 2010 I had to use the following to get it to work for me. $oForm = _IEFormGetCollection($oIE, 0) _IEFormElementCheckBoxSelect($oForm, 0, "", 1, "byIndex") Link to comment Share on other sites More sharing options...
sun Posted November 9, 2010 Author Share Posted November 9, 2010 Thank you for ur reply. I tried to some functions. And $oForm is returned to null in the following msgbox. $oForm = _IEFormGetCollection($oIE, 0) MsgBox(0, "Form return value", "There are " & $oForm ) Sleep(20000) _IEFormElementCheckBoxSelect ($oForm,0,"",1,"byIndex") I changed it. However, $_IEStatus_InvalidObjectType is occured from function _IEFormElementCheckboxSelect. $oTable = _IETableGetCollection ($oIE, 0) $iNumtables = @extended MsgBox(0, "Table Info", "There are " & $iNumtables ) Sleep(2000) $oCheckbox=_IEFormElementCheckBoxSelect($oTable,0,"",1,"byIndex") MsgBox(0, "Table Info", "There are " & $oCheckbox ) Link to comment Share on other sites More sharing options...
sun Posted November 9, 2010 Author Share Posted November 9, 2010 Thank you for ur reply.I tried to some functions.And $oForm is returned to null in the following msgbox.$oForm = _IEFormGetCollection($oIE, 0)MsgBox(0, "Form return value", "There are " & $oForm )Sleep(20000)_IEFormElementCheckBoxSelect ($oForm,0,"",1,"byIndex")I changed it. However, $_IEStatus_InvalidObjectType is occured from function _IEFormElementCheckboxSelect.$oTable = _IETableGetCollection ($oIE, 0)or$a1 = _IEGetObjById($oIE, "instances-panel_datatable")$oCheckbox=_IEFormElementCheckBoxSelect($oTable,0,"",1,"byIndex")MsgBox(0, "Table Info", "There are " & $oCheckbox )or Link to comment Share on other sites More sharing options...
water Posted November 9, 2010 Share Posted November 9, 2010 (edited) What do you get when you change the script to output @error as well? $oForm = _IEFormGetCollection($oIE, 0) MsgBox(0, "Form return value", "There are " & $oForm & " Error: " & @error ) According to the help file _IEFormGetCollection "Returns a collection object variable representing the Forms in the document or a single form by index." I suspect there are no forms (<Form> and </FORM>) in your html code. Edited November 9, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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