Quiesel Posted May 16, 2013 Share Posted May 16, 2013 Hello AutoIT Community, I am trying to right click a link in a div that is not viewable before scrolling down, but I have no more ideas left how to reach that goal. Here is what I currently do: - Search and find the div - _IEAction($oDiv, "focus") ;Div is now in the visible area (scrolled down) - Calculate screenposition of $oDiv - MouseClick("secondary", $x, $y) It does what it should but it clicks at the screen where the div was before focusing it, therefore clicking at the wrong position in the browser window. I did a small script to show you my problem: #include <ie.au3> _IEErrorHandlerRegister() $sHtml = "<html><head><title>Test</title></head><body><div style='border: 2px solid green; width: 250px; height: 100px; overflow: scroll;'><div style='border: 2px solid red; position: relative; width: 90px; height: 500px'><div class='notme' style='border: 1px solid black; height: 100px'>Notme</div><div class='notme' style='border: 1px solid black; height: 100px'>Notme</div><div class='notme' style='border: 1px solid black; height: 100px'>Notme</div><div class='notme' style='border: 1px solid black; height: 100px'>Notme</div><div id='selectme' style='height: 100px'><a href='#'>Select me</a></div></div></div></body></html>" Local $oIE = _IECreate() _IEBodyWriteHTML($oIE, $sHTML) Local $oDiv = _IEGetObjById($oIE, "selectme") _IEaction($oDiv,"focus") Local $iScreenX = _IEPropertyGet($oDiv, "screenx") Local $iScreenY = _IEPropertyGet($oDiv, "screeny") Local $iWidth = _IEPropertyGet($oDiv, "width") Local $iHeight = _IEPropertyGet($oDiv, "height") MouseClick("secondary", $iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, 1 ,10) The screenposition of $oDiv is not updated after focussing it. Any ideas how to solve this problem would be highly appreciated. Best regards, Chris Link to comment Share on other sites More sharing options...
Bert Posted May 16, 2013 Share Posted May 16, 2013 You may want to use the other IE commands to do what you have in mind. I'm not that experienced with them but I do know (I hope I'm right here) you can reference a link directly after performing a collection. Look at the examples in the help file and you will see what I'm talking about. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
jdelaney Posted May 16, 2013 Share Posted May 16, 2013 _IEaction, with action = Focus, brings that element into focus, and visiblitiy. Why are you attempting right click? You can get the href, and open in a new window. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Quiesel Posted May 17, 2013 Author Share Posted May 17, 2013 I need to right click because it opens a context menu. This framework is used: http://dojotoolkit.org/reference-guide/1.9/dijit/Menu.html I worked around the problem by sending Shift+F10 which opens the menu without the requirement to position the mouse correctly. 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