sun Posted November 8, 2010 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>
water Posted November 8, 2010 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
IndyUK Posted November 8, 2010 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")
sun Posted November 9, 2010 Author 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 )
sun Posted November 9, 2010 Author 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
water Posted November 9, 2010 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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