Jump to content

_IEFormElementCheckBoxSelect [SOLVED]


rootx
 Share

Recommended Posts

Does what you're doing not work? The 1 as the 4th parameter of _IEFormElementCheckBoxSelect should be checking the box.

EDIT: You may need to specify a string in the second parameter. You do need to specify, since your checkbox has no value you might want to change $sMode to 0 so it goes by index. Then you could do:

_IEFormElementCheckBoxSelect($chk, 0, "", 1, 0)

if it was the first checkbox on the page.

EDIT2: Danp2 is right, I missed that. You need to have

<input id="cb-select-all-1" type="checkbox" name="cb1">

$chk= _IEFormGetObjByName($oIE,"cb1")
_IEFormElementCheckBoxSelect($chk, "", "", 1)

I may be wrong, since my IE automation is a little rusty.

Edited by anthonyjr2

UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Link to comment
Share on other sites

I

19 hours ago, Danp2 said:

_IEFormElementCheckBoxSelect is expecting the form object as the first parameter, not the checkbox element.

True, I find it,

$chk= _IEGetObjById($oIE,"bulk-action-form") ;form name
_IEFormElementCheckBoxSelect($chk,0,"", 1, "byIndex") ; checkbox

Now How can I get all checkbox index numb?  They randomly change, and write my (for next loop) I nned to get the totals checks on the page. I try but return empty values.

My target

$chk= _IEGetObjById($oIE,"bulk-action-form")
For $1 = 0 to 30 <-------------- The exactly tot num in the page
    _IEFormElementCheckBoxSelect($chk,$1,"", 1, "byIndex")
Next
$chk= _IEGetObjById($oIE,"bulk-action-form")
_IEFormElementCheckBoxSelect($chk,0,"", 1, "byIndex");work
_IEFormElementCheckBoxSelect($chk,1,"", 1, "byIndex");work

;try get all index values
Local $oForms = _IEFormGetCollection($chk)
Local $iNumForms = @extended
Local $oForm
For $i = 0 To $iNumForms - 1
    $oForm = _IEFormGetCollection($chk, $i)
   ConsoleWrite($oForm.name&@CRLF)
Next

 

Edited by rootx
Link to comment
Share on other sites

1 hour ago, Danp2 said:

Sorry, but I don't understand your question. Please restate and show the associated HTML if you think that will help.

THX,

1. I want to know how many checkbox contains a web page

2. Is not a static page, then every time the number of check box changed

3. After finding the number of check boxes on the page, I will use this number to set the limit of my FOR loop.

Ex. The php page contains 30 checkbox now, after 10 minutes 20, 10..... how can I get (READ) this number?

$totchk = 30
$chk= _IEGetObjById($oIE,"bulk-action-form")
For $1 = 0 to $totchk <-------------- The exactly tot num in the page
    _IEFormElementCheckBoxSelect($chk,$1,"", 1, "byIndex")
Next

I have tried before to grab this number without success.

;try get all index values
$chk= _IEGetObjById($oIE,"bulk-action-form")
Local $oForms = _IEFormGetCollection($chk)
Local $iNumForms = @extended
Local $oForm
For $i = 0 To $iNumForms - 1
    $oForm = _IEFormGetCollection($chk, $i)
   ConsoleWrite($oForm.name&@CRLF)
Next

 

Edited by rootx
Link to comment
Share on other sites

Ok... Looks like you are using the wrong commands. Try this piece of untested code:

$cnt = 0

$oForm = _IEGetObjById($oIE,"bulk-action-form")

$oElements = _IEFormElementGetCollection($oForm, -1)

For $oElement In $oElements
    If $oElement.type = "checkbox" Then
        $cnt += 1
    EndIf
Next

MsgBox(64, $cnt, "Checkbox count")

 

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...