Jump to content

How to click this menu button? - (Moved)


Recommended Posts

23 minutes ago, Pagi said:

 

ConsoleWrite($oLink.innerText)

Returns "Menu Item 1" only.

Right... because as I stated before

On 8/8/2018 at 3:48 PM, Danp2 said:

Your ExitLoop is in the wrong place

Try running this code (page needs to be already open in IE) --

#include <IE.au3>

Local $oIE = _IEAttach("pagi_blog", "url")

$oDiv = _IEGetObjById($oIE, "submenu2")
$oLinks = _IETagNameGetCollection($oDiv, "a")
;$oLinks = _IELinkGetCollection($oDiv)

For $oLink In $oLinks
   ConsoleWrite($oLink.innerText & @CRLF)

   If StringInStr($oLink.innerText,"Menu Item 1") Then
       ConsoleWrite('Found link!' & @CRLF)

      _IEAction($oLink, "click")
      ExitLoop
   EndIf
Next

 

Link to comment
Share on other sites

Ok, I finally got it. Here´s how I solved it.

Local $sMyString = "Menu Item 2"
Local $oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
    Local $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
        _IEAction($oLink, "click")
        ExitLoop
    EndIf
Next

 

Danp2,  thank you very much for your support!

Edited by Pagi
Link to comment
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
 Share

×
×
  • Create New...