Jump to content
Sign in to follow this  
Skysis

Selecting options from HTML drop-down list.

Recommended Posts

Skysis

Hello,

I'm trying to automate an HTML drop-down list selection, but haven't been able to do it successfully with the _IE functions.    I'd love to give you the actual page, but it sits behind my login.  The relevant HTML is as follows:

<form action="/ads/CaseLogs/CaseEntry/Insert" method="post">    
  <div class="header fixed-scroll">
  <div class="pull-right">
  <button type="submit" class="btn btn-success" id="submitButton">Submit</button>
 
<li class="default-width"><label for="Institution">Institution</label> 
<select data-val="true" data-val-required="This field is required." id="Institutions" name="Institutions">
<option value="">-- Select --</option>
<option value="13381">Location 1</option>
<option value="13182">Location 2</option>
<option value="13405">Location 3</option>
<option value="19367">Other Institution</option>
</select>
 
All I want to do is to select the desired location from the drop-down list.  "Select" is there by default.
_IETagNameGetCollection was able to pull all the elements from the drop-down list but I was unable to force selection.  I tried _IEFormElementOptionSelect, but there is no form name or ID, and I was not able to make it work.  Any suggestions?
 
Thanks

Share this post


Link to post
Share on other sites
MikahS

How did you try and use

_IEFormElementOptionSelect

Did you try and pass it the correct object returned with your selection to

_IEFormElementOptionSelect

Posting your code would help out greatly to see what you are doing :)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Skysis

How did you try and use

_IEFormElementOptionSelect

Did you try and pass it the correct object returned with your selection to

_IEFormElementOptionSelect

Posting your code would help out greatly to see what you are doing :)

 

I tried this 3 different ways, as below.  Nothing worked.  Would appreciate any suggestions, thanks:

1.

$oIE1 = _IECreate("https://www.acgme.org/ads/CaseLogs/CaseEntry/Insert")

$oLocList = _IEGetObjByName($oIE1, "Institutions")

_IEPropertySet($oLocList, "innertext", "Location 2")

2.

$oIE = _IECreate("https://www.acgme.org/ads/CaseLogs/CaseEntry/Insert")

$oDownloadSamples = _IEGetObjById($oIE, "Institiutions")

$oDownloadSamplesSelect = _IETagNameGetCollection($oDownloadSamples, "select", 0)

$oDownloadSamplesSelect.focus

_IEFormElementOptionSelect($oDownloadSamplesSelect, "Location 2", 1, "byText")

3.

$oIE = _IECreate("https://www.acgme.org/ads/CaseLogs/CaseEntry/Insert")

Local $oForm = _IEFormGetObjByName($oIE, "Institutions")

Local $oSelect = _IEFormElementGetObjByName($oForm, "Location 2")

_IEAction($oSelect, "focus")

 

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  

×