Jump to content

Need help finding 'menu links' in IE html page


 Share

Recommended Posts

I can get all the links on a page using IELinkGetCollection, but if I am looking for just the items under menu BBB (see code below), what approach should I use to find them in AutoIt (and they don't all start with B in the real html file)?

Thanks,

-Bill

<div id="menuGreen" class="menu">
    <ul>
      <li>
        <a id="menuGreen" title="AAA" href="aaa.htm">AAA</a>
        <ul>
          <li>
            <a title="A01" href="a01.htm"> a01</a>
          </li>
          <li>
            <a title="A02" href="a02.htm"> a02</a>
          </li>
          <li>
            <a title="A03" href="a03.htm"> a03</a>
          </li>
          <li>
            <a title="A04" href="a04.htm"> a04</a>
          </li>
        </ul>
      </li>
      <li>
        <a id="menuGreen" title="BBB" href="bbb.htm">BBB</a>
        <ul>
          <li>
            <a title="B01" href="b01.htm"> b01</a>
          </li>
          <li>
            <a title="B02" href="b02.htm"> b02</a>
          </li>
          <li>
            <a title="B03" href="b03.htm"> b03</a>
          </li>
        </ul>
      </li>
    </ul>
  </div>
Link to comment
Share on other sites

Assuming the struction of the HTML is constant, take advantage of the fact that _IETagnameGetCollection works with the DOM hierarchy:

$oDiv = _IEGetObjById($oIE, "menuGreen")
$oUL = _IETagnameGetCollection($oDiv, "ul", 2) ; 3rd ul in div
$oLinks = _IETagnameGetCollection($oUL, "a") ; collection of BBB items

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