Jump to content

How to click the href in HTML5 web page


Recommended Posts

I just started to use AutoIt.
Could anyone help me how to click the link below? Thanks a lot.
 

<li class="with-children closed" data-bind="template: template, css: {'disabled': isDisabled, 'with-children closed': hasChildren, 'without-children': !hasChildren(), 'current': isCurrent, 'open': isExpanded, 'closed': !isExpanded(), 'inactive': isInactive, 'ancestor': isAncestor}, attr: {'data-hj-test-id': testId}"><!-- ko ifnot: hasChildren --><!-- /ko -->
<!-- ko if: hasChildren -->
<a href="#" data-bind="click: click">
    <i data-bind="css: css"></i>
    <!-- ko if: observableText() -->
    <span data-bind="text: observableText">Translations</span>
    <!-- /ko -->
    <!-- ko if: showDropDownCaret -->
    <i class="fa fa-caret-down icon-root-with-children"></i>
    <!-- /ko -->
</a>
<ul class="dropdown-content stacked stacked-tertiary">
    <!-- ko if: !$data.parent && $data.hasChildrenWithChildren() --><!-- /ko -->
    
    <!-- ko if: isExpanded --><!-- /ko -->
</ul>
<!-- /ko --></li>

I tried the following two ways but all failed.

_IELinkClickByText($oIE, "Translations")

or 

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

 

Link to comment
Share on other sites

2 hours ago, FrancescoDiMuro said:

@MonicaLu
Could you share the link of the webpage? :)

Hi FrancescoDiMuro
Sorry I can not share the link of the webpage because it is an internal webpage which can only be accessed in our domain.
I have got it work with the following code. Thanks anyway.

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

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...