Jump to content

Recommended Posts

Posted

Hi All,

I have been at this for about a week and a half now and can't figure it out.

I am trying to click a share button on an IE webpage here is the html

<div class="social-info social-actions d-fl ai-c jc-c">
    <ul class="listing-actions-con d-fl ai-c jc-sb" id="7892-listing-actions">
        <li class="d-fl ai-c likes" data-count="0">
            <a class="auth-required unlike auth-required f-hide" data-ajax="true" data-ajax-href="/listing/7892/unlike" data-authorized="true" data-pa-attr-listing_id="7892" data-pa-attr-location="like_bottom" data-pa-click-type="button" data-pa-name="unlike" data-post-id="7892">
                <i class="icon liked"></i>
            </a>
            <a class="auth-required like auth-required " data-ajax="true" data-ajax-href="/listing/7892/like" data-authorized="true" data-pa-attr-listing_id="7892" data-pa-attr-location="like_bottom" data-pa-click-type="button" data-pa-name="like" data-pmrd="{ &quot;usehref&quot; : &quot;true&quot;}" data-post-id="7892">
                <i class="icon like"></i>
            </a>
            <div class="like-count-con">
                <span class="count f-hide"></span>
            </div>
        </li>
        <li class="d-fl ai-c">
            <a class="comment auth-required" data-pa-name="comment" data-pmrd="{ &quot;usehref&quot; : &quot;true&quot;}" href="item-7982#comment">
                <i class="icon comment-gray"></i>
            </a>
            <span class="count f-hide"></span>
        </li>
        <li class="d-fl ai-c">
            <a class="share" data-pa-attr-listing_id="7892" data-pa-click-type="button" data-pa-name="share" data-target="#share-popup" data-toggle="modal">
                <i class="icon share-gray"></i>
            </a>
        </li>
    </ul>
</div>

I am trying to click the class share button but just can't figure out how.  I am sure it is stupid easy and I am just doing something done.

#include <IE.au3>
#include <MsgBoxConstants.au3>

;Assume other code exists before this that navigating to needed webpage

Local $oIE = _IEAttach($oIE)
Local $oForm = _IEGetObjByID($oIE, "7892")
MsgBox($MB_SYSTEMMODAL, "Line1", $oForm.innertext)

Local $oElements = _IETagNameAllGetCollection($oForm)
For $oElement In $oElements
    If $oElement.id Then MsgBox($MB_SYSTEMMODAL, "Element Info", "Tagname: " & $oElement.tagname & @CRLF & "id: " & $oElement.id & @CRLF & "innerText: " & $oElement.innerText)
Next

I am just not getting the element to get the button.

Still pretty new to AutoIT so any help would be appreciated.

 

Thank You

Posted

Hey see below:

 

;================================
;
; Credit To: PsaltyDS
;
; Found @: https://www.autoitscript.com/forum/topic/116614-_ie-how-to-click-item-by-class/
;
;================================



$oFound = ""
$colLinks = _IELinkGetCollection($oIE)
For $oLink In $colLinks
    If $oLink.className & "" = "share" Then
        $oFound = $oLink
        ExitLoop
    EndIf
Next
If IsObj($oFound) Then 
    MsgBox(64, "Success", "Found it!")
Else
    MsgBox(16, "Failed", "Not found.")
EndIf

 

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...