mikesjra Posted April 22, 2011 Share Posted April 22, 2011 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") ExitLoop EndIf Next 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 tooltipController="tooltipController" onActionselect="window.top.handleAction();" popupController="popupController" fixedMenuContainer="leftHTMLContainer"> <TABLE class=classNavTracker border=0 cellSpacing=0 cellPadding=0 align=left> <TBODY> <TR> <TD id=ms__id70 class=classNavTrackerTaskLabel noWrap navigationSectionID="{B9699DD0-7B05-4A5F-80E2-7E909879BCE7}" navigationLabelType="TaskLabel">Plan Transactions</TD></TR></TBODY></TABLE></navroot:NavTracker></navroot:Header><navroot:Footer style="Z-INDEX: -1000; VISIBILITY: hidden" onpropertychange=handleComponentonpropertychange(); id=footer tooltipController="tooltipController"> <TABLE border=0 cellSpacing=2 cellPadding=0 align=center> <TBODY> <TR></TR></TBODY></TABLE></navroot:Footer><navroot:GenericHTMLContainer 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 nmCurActiveMenuItemRowIndex="null"> <TBODY> <TR class="classNavTrackerFixedMenuItem classNavTrackerFixedMenuItemHasAction" menuItemName="AHPlanAuthorizations" hasSubMenu="true" navigationSectionID="{B9699DD0-7B05-4A5F-80E2-7E909879BCE7}" navigationLabelType="FixedMenuItem" actionName="AHPlanAuthorizations"> <TD class=classNavTrackerFixedMenuItemCell noWrap>Authorizations</TD> <TD class=classNavTrackerFixedMenuItemCell noWrap>></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! Mike Link to comment Share on other sites More sharing options...
mikesjra Posted April 22, 2011 Author Share Posted April 22, 2011 (edited) Update... 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 April 22, 2011 by mikesjra Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 22, 2011 Share Posted April 22, 2011 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now