Jump to content

Parsing HTML Form with IE.au3


Recommended Posts

Hello

I'm trying to parse a html form file with ie.au3. I got the following problem: some tag do not have neither name nor type.

<FIELDSET class=defaut >

......

</FIELDSET >

with:

$oProfile = _IEFormGetCollection ($oFrame,0)

$oElements = _IEFormElementGetCollection($oProfile)

For $oElement In $oElements

MsgBox(0, "Tag Names", "Tag: " & $oElement.name )

Next

I get an error when I try to read the name of the "Fieldset" tag... Do you have an idea to avoid this error?

Thx

Tom

Edited by TomTJ
Link to comment
Share on other sites

Hello

I'm trying to parse a html form file with ie.au3. I got the following problem: some tag do not have neither name nor type.

<FIELDSET class=defaut >

......

</FIELDSET >

with:

$oProfile = _IEFormGetCollection ($oFrame,0)

$oElements = _IEFormElementGetCollection($oProfile)

For $oElement In $oElements

MsgBox(0, "Tag Names", "Tag: " & $oElement.name )

Next

I get an error when I try to read the name of the "Fieldset" tag... Do you have an idea to avoid this error?

Thx

Tom

You pulled a Frame object and then tried to enumerate objects from a Form (not the same thing). Have you examined the object with DebugBar or a similar DOM inspector? I think you'll find you need more of the path to the object. What does the error in the SciTE console say? Something about $oProfile not being a valid object for use in _IEFormElementGetCollection()?

Demo:

#include <IE.au3>

$oIE = _IE_Example("FrameSet")
$oFrame = _IEFrameGetCollection($oIE, 0); Get first frame
$colElements = _IEFormElementGetCollection($oFrame)

Output:

--> IE.au3 V2.3-1 Error from function _IEFormElementGetCollection, $_IEStatus_InvalidObjectType

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thx for your answer.

The only problem I have is a "name" tag problem.

If I change

<FIELDSET class=defaut >

to

<FIELDSET class=defaut name=test>

I get: $oElement.name -> "test"

But I get the same error with $oElement.type since type is not defined in the HTML tag. I will try your trick with the debugger tonight...

Edited by TomTJ
Link to comment
Share on other sites

What are you actually trying to do?

FIELDSET is an HTML tag, but it is an odd one. It shows up as part of a FormElement collection, but it has no .type property as all others do. It is not required that a tag have a Name assigned.

Unless you really need to know about it, you may just wnat to skip it:

If $oElement.tagName = "fieldset" then ContinueLoop

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

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