Sign in to follow this  
Followers 0
mdcastle

SOLVED _IEFormElementOptionSelect help

2 posts in this topic

#1 ·  Posted (edited)

I'm trying to automate the selection of an <option value> in an IE form. The form I am automating does not have a "name" or "id" value so i can't use _IEFormGetObjByName and then _IEFormElementGetObjByName.

So I have the following code:

$oForm = _IEFormGetCollection($OpenIE, 0)
$oSelect = _IEFormElementGetCollection($oForm)
_IEFormElementOptionSelect($oSelect, "5449", 1, "byValue")

I'd prefer to use _IEFormElementGetObjByName but $s_name is not static i.e. it could be "add_role_12345" or "add_role_54321", etc.

Can anyone give me an example of how I can make this work?

NB There is only one select box on the form.

Many thanks in advance.

Edited by mdcastle

Share this post


Link to post
Share on other sites



solved by finding indexed instance using

$iElemCnt = @extended
  $sMsg = "Element values:" & @CRLF
  $i = 0
  For $oElem In $oSelect
   $sMsg &= $i & ":  " & _IEFormElementGetValue($oElem) & @CRLF
   $i += 1
  Next
  MsgBox(64, $iElemCnt & " Results", $sMsg)

then amending

$oSelect = _IEFormElementGetCollection($oForm)
to
$oSelect = _IEFormElementGetCollection($oForm, 10)

Share this post


Link to post
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
Sign in to follow this  
Followers 0