Jump to content

How to script Checkbox in IE


sun
 Share

Recommended Posts

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

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 - 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 (NEW 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

 

Link to comment
Share on other sites

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

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

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 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 - 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 (NEW 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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...