Jump to content
Sign in to follow this  

IE - Javascript submenu

Recommended Posts

Hey folks,

I'm stuck, and greatly appreciate any help. I'm automating the clicking of menu's within a secured site. There is a javascript menu on the left side of the page. I am able to click a top level menu item, but not the submenu item. I am trying to click on the 'AIM' submenu item (picture attached).

I am able to click on the top level menu item 'Authorizations' with the following snippet of code:

$oElements = _IETagNameGetCollection ($oIE, "TR")
        For $oElement in $oElements
            $oinnerElement = _IEPropertyGet($oElement, "innerText")
            ;$isobj = IsObj($oinnerElement) ;It returns 1
            ;MsgBox(0, "", $isobj)
            If StringInstr($oinnerElement, "Authorizations>") Then

                ;MsgBox(0, "Sweet!", "Found Link!")
                _IEAction ($oElement, "click")


Running the code above gives me the submenu. But, I'm not sure how to click on any of the submenu items.

Here is the source code I'm clicking on for the Authorizations menu item (see bottom of snippet):

<!-- The workflow tracker --><navroot:NavTracker 
style="WIDTH: 944px; HEIGHT: 17px; OVERFLOW: hidden; TOP: 50px; LEFT: 0px" 
onpropertychange=header.handleContainedElementsonpropertychange(); id=navTracker 
onActionselect="window.top.handleAction();" popupController="popupController" 
<TABLE class=classNavTracker border=0 cellSpacing=0 cellPadding=0 align=left>
    <TD id=ms__id70 class=classNavTrackerTaskLabel noWrap 
style="Z-INDEX: -1000; VISIBILITY: hidden" 
onpropertychange=handleComponentonpropertychange(); id=footer 
<TABLE border=0 cellSpacing=2 cellPadding=0 align=center>
style="Z-INDEX: 0; WIDTH: 243px; HEIGHT: 473px; VISIBILITY: visible; TOP: 67px; LEFT: 0px" 
onpropertychange=handleComponentonpropertychange(); id=leftHTMLContainer>
<TABLE id=ms__id69 border=0 cellSpacing=0 cellPadding=0 
  <TR class="classNavTrackerFixedMenuItem classNavTrackerFixedMenuItemHasAction" 
  menuItemName="AHPlanAuthorizations" hasSubMenu="true" 
  navigationLabelType="FixedMenuItem" actionName="AHPlanAuthorizations">
    <TD class=classNavTrackerFixedMenuItemCell noWrap>Authorizations</TD>
    <TD class=classNavTrackerFixedMenuItemCell noWrap>&gt;</TD></TR>

I've tried using DebugBar, but I can't see the source code of the submenu, so I'm not sure what to look for. I've tried running the gettagecollection again after the submenu comes up, but it doesn't see any of the submenu items. I've also seen the example in the help menu on how to click div submenu's, but this doesn't appear to be using any div's for the menu.

I'm sure this isn't enough information. Please let me know what other info you might need, or if you have any other tips.

Thanks so much!



Share this post

Link to post
Share on other sites


I'm trying to use the following code to click the submenu item. But nothing appears to happen:

$iBrowserX = _IEPropertyGet($oElement, "browserx")
$iBrowserY = _IEPropertyGet($oElement, "browserY")
$iWidth = _IEPropertyGet($oElement, "width")
$iHeight = _IEPropertyGet($oElement, "height")
ControlClick(_IEPropertyGet($oIE, "hwnd"), "", "", "left", 1, $iBrowserX + $iWidth*1.2, $iBrowserY + $iHeight/2)

I've set the width to width*1.2 to try to move the click slightly to the right of the top level menu to click on the sub menu. The sub-menu pops up, but when the control click happens the cursor winds up in the browser address bar for some reason.

Edited by mikesjra

Share this post

Link to post
Share on other sites

Try using the control ID in your ControlClick():

ControlClick(_IEPropertyGet($oIE, "hwnd"), "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "left", 1, $iBrowserX + $iWidth*1.2, $iBrowserY + $iHeight/2)


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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...