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