Jump to content

Recommended Posts

Posted

Yeah, sorry, I forgot to mention it. I added 

Else
MsgBox($MB_SYSTEMMODAL,"Error", "not found")

That means the text was not found. I have tested it on all menu items and no text was found because this else statement always return.

Posted
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

 

Posted (edited)

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

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
×
×
  • Create New...