Jump to content

[Resolved] Get the text of the Options in a select of a Form


Recommended Posts

Is it posible to get all the text of the Options in a field select of a form using the _IE object?

I tryied _IEFormElementGetCollection & _IEFormElementOptionselect without success...

I have in a form

<select name="actDatos" size=5>
        <option value="4"> ANÁLISIS CLÍNICOS </option>
        <option value="30"> FISIOTERAPIA </option>
        <option value="51"> MEDICINA GENERAL /  DE FAMILIA </option>
...
</select>

and I want to get all the text of all of the options.

Edited by mailmaster
Link to comment
Share on other sites

Is it posible to get all the text of the Options in a field select of a form using the _IE object?

I tryied _IEFormElementGetCollection & _IEFormElementOptionselect without success...

I have in a form

<select name="actDatos" size=5>
        <option value="4"> ANÁLISIS CLÍNICOS </option>
        <option value="30"> FISIOTERAPIA </option>
        <option value="51"> MEDICINA GENERAL /  DE FAMILIA </option>
...
</select>

and I want to get all the text of all of the options.

The answer was found in the forum:

http://www.autoitscript.com/forum/index.php?showtopic=61538

via

$oSelect = _IEFormElementGetObjByName ($oFormulario, "actDatos")
    For $oItem In $oSelect.options
        $sItems=$oItem.text & @CRLF
    Next
Link to comment
Share on other sites

Is it posible to get all the text of the Options in a field select of a form using the _IE object?

I tryied _IEFormElementGetCollection & _IEFormElementOptionselect without success...

I have in a form

<select name="actDatos" size=5>
        <option value="4"> ANÁLISIS CLÍNICOS </option>
        <option value="30"> FISIOTERAPIA </option>
        <option value="51"> MEDICINA GENERAL /  DE FAMILIA </option>
...
</select>

and I want to get all the text of all of the options.

IE.au3 does not provide a convenience function for this, you need to use the DOM. For example:

#include <IE.au3>
$oIE = _IECreate(your-url)
$oSelect = _IEGetObjByName($oIE, "actDatos")
$oOptions = $oSelect.options
For $oOption in $oOptions
    ConsoleWrite("Value: " & $oOption.value & " Text: <" & $oOption.text & ">" & @CRLF)
Next

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

IE.au3 does not provide a convenience function for this, you need to use the DOM. For example:

#include <IE.au3>
$oIE = _IECreate(your-url)
$oSelect = _IEGetObjByName($oIE, "actDatos")
$oOptions = $oSelect.options
For $oOption in $oOptions
    ConsoleWrite("Value: " & $oOption.value & " Text: <" & $oOption.text & ">" & @CRLF)
Next

Dale

Thank you very much and by my side this thread can be closed.
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...