Sign in to follow this  
Followers 0
bill73

Need help finding 'menu links' in IE html page

3 posts in this topic

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>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I was thinking of 'Tagname get collection' only applying to tags that explicitly had the NAME attribute set within the tag. Your example makes everything clear now. Thanks so much.

-Bill

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  
Followers 0