Jump to content

_IE & Webpage Hierarchies


RobMac
 Share

Recommended Posts

Guys,

Newbie to _IE functions trying to deal with really complex structured websites. I have DebugBar and that works great to identify the names of various elements frames etc. The HTML page I am trying to work with has multiple frames so attaching the html is a pain (at least for me) - I did attach an image that is a screen capture of the hierarchy as identified by DebugBar and circled the stuff I am interested in getting to.

I dont really know anything about DOM (p.s. it would be great if the _IE help files had either some basic DOM elelment info or a link to a webpage that provides basic info on what are elements we can use)

1. I am not asking for final code but just want to see an idea of the correct functions to use to get at the various levels of the hierarchy. For example, I am not sure how to reference a select element or a table row nor if it is even necessary within this nested structure - it really comes down to not knowing what makes up a level in the hierarchy...

1b. I will add that as an indepedent question: what makes up a level in this hierarchy? What is the correct list of the hierarchy for the image attached? Is every nested row (or row/column) another level that must be referenced in my script?

2. Is there a function in DebugBar that can tell me the total DOM hierarchy to access an element nested in frames, multiple levels of forms, tables, etc...? Some way to view the object/element type at each level down to the one I am interested in and paste this into my program. - I guess that could be written with AutoIt using DebugBar:)

3. Is there an easier way then accessing each level of the hierarchy then iterating and looking within each lower level with the next function ad infinitum... For example, this is an earlier part of the script which works but maybe there is an easier way to do this...

$oLNForm = _IEFormGetCollection($oIE, 0)

$oLNDate = _IEFormElementGetObjByName($oLNForm, "dateSelector")

_IEFormElementOptionselect ($oLNDate, "All")

$oLNSearchQ = _IEFormElementGetObjByName($oLNForm, "searchTermsTextArea")

_IEFormElementSetValue($oLNSearchQ, $QueryString)

_IEImgClick ($oLNForm, "Search")

or another area:

$oSumFrame = _IEFrameGetCollection ($oIE,2)

$oSumTable = _IETableGetCollection ($oSumFrame, 2)

$SumTableData = _IETableWriteToArray ($oSumTable)

$TotalArtCountElem = $SumTableData[0][0]

Those functions are pretty strait forward but it seems for the HTML in the attached image I am going to run 10 or so drill down functions to get to that selectbox / image.

Thanks for any help and I hope the question is clear.

-Rob

post-27892-1192977525_thumb.jpg

Link to comment
Share on other sites

The HTML page I am trying to work with has multiple frames so attaching the html is a pain

You just need to drill into each nested frame from the higher level. A pain? yeah.

I dont really know anything about DOM (p.s. it would be great if the _IE help files had either some basic DOM elelment info or a link to a webpage that provides basic info on what are elements we can use)

You'll find this in the output of _IE_Introduction() -- this is the best way I could figure out to get general information about IE.au3 into the helpfile.

1. I am not asking for final code but just want to see an idea of the correct functions to use to get at the various levels of the hierarchy. For example, I am not sure how to reference a select element or a table row nor if it is even necessary within this nested structure - it really comes down to not knowing what makes up a level in the hierarchy...

You typically get references to elements by ID, Name or as part of some collection. There are special collections of forms, links, frames etc. and there are generic collections by tagname (there are IE.au3 functions using each of these).

1b. I will add that as an indepedent question: what makes up a level in this hierarchy? What is the correct list of the hierarchy for the image attached? Is every nested row (or row/column) another level that must be referenced in my script?

That does show a view of the heirarchy, but as mentioned above, that is not the only way to drill into it. There are also many different ways to traverse the heirarchy using collections and .partent, .sibling and .child properties. It takes some study.

2. Is there a function in DebugBar that can tell me the total DOM hierarchy to access an element nested in frames, multiple levels of forms, tables, etc...? Some way to view the object/element type at each level down to the one I am interested in and paste this into my program. - I guess that could be written with AutoIt using DebugBar:)

Not exactly, but it gives you information you can use with a solid understanding of the DOM to figure it out.

3. Is there an easier way then accessing each level of the hierarchy then iterating and looking within each lower level with the next function ad infinitum...

See suggestions above.

For example, this is an earlier part of the script which works but maybe there is an easier way to do this...

$oLNForm = _IEFormGetCollection($oIE, 0)

$oLNDate = _IEFormElementGetObjByName($oLNForm, "dateSelector")

_IEFormElementOptionselect ($oLNDate, "All")

$oLNSearchQ = _IEFormElementGetObjByName($oLNForm, "searchTermsTextArea")

_IEFormElementSetValue($oLNSearchQ, $QueryString)

_IEImgClick ($oLNForm, "Search")

You do not have to drill through the Form Collection... you can get the element reference disrectly with _IEGetObByName or _IEGetObjByID.

or another area:

$oSumFrame = _IEFrameGetCollection ($oIE,2)

$oSumTable = _IETableGetCollection ($oSumFrame, 2)

$SumTableData = _IETableWriteToArray ($oSumTable)

$TotalArtCountElem = $SumTableData[0][0]

If the table has a name or ID you do not need to use the collection -- they typically do not however.

Those functions are pretty strait forward but it seems for the HTML in the attached image I am going to run 10 or so drill down functions to get to that selectbox / image.

See big_daddy's example.

Thanks for any help and I hope the question is clear.

-Rob

I think you'll find that these sort of long get-all-by-questions-off-my-chest-at-once are not common in this forum. It took me a while to set aside the time required to give you a thoughtful answer - and I almost didn't. Suggest taht in the future you ask more pointed questions taht move along your understanding and can be answered relatively quickly by those with the knowledge to help you.

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