Jump to content

Why is clicking this webpage button so hard!?!?!


Recommended Posts

Hi All,

Moderate user here.  I am trying to click a button on a webpage and can't seem to be able to do it.

This is the html code

<a class="auth-required btn blue" data-ajax="data-ajax" data-ajax-href="/user/5a3496eba0da4d0051258446/follow_user" data-ajax-method="post" data-pa-name="follow_user" id="follow-user">Follow</a>

All I want to do is hit the button but so far everything I have tried through object grabbing hasn't worked.  I'm sure the solution is extremely simple and I am mising something.

Any help is much appreciated.

 

Thank You!

Link to comment
Share on other sites

Sorry I typed that really quick earlier today

It is in IE

I have tried this thinking the href of the link would work but so far nothing

 

Local $oIE = _IEAttach("website")
   Local $oLinks = _IELinkGetCollection($oIE)
   Local $iNumLinks = @extended

   Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF

   For $oLink In $oLinks
        $sTxt &= $oLink.href & @CRLF
   Next

   Local $aArray = StringSplit($sTxt, @CR)
   _ArrayDisplay($aArray,")

I'd rather not say the name of the site but it is a marketplace website where you follow people to see what they are selling, the more you follow the more you items you can see for sale

Link to comment
Share on other sites

So,what's the output of the array?  also.

Rather than concatenating strings and then string splitting, you can just _arrayadd. or in the loop, consolewrite.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

I'm very sorry, I have been trying to do this all day with a fussy 6 month old on my lap..... 

Here is more complete html code 

<div class="d-fl jc-sb"><div class="user-content"><a href="/closet/paintedhanger"><img alt="paintedhanger" class="user-image l" src="https://di2ponv0v5otw.cloudfront.net/users/2019/04/03/5ca2ae5b86a604d9a65a45dd/t_5ca54ecab50281c375851c75.jpg" title="paintedhanger"></a><label><h4><a href="/closet/paintedhanger">!</a></h4><h5><a href="/closet/paintedhanger">@paintedhanger</a></h5></label></div><div class="d-fl ai-c"><a class="auth-required btn blue" data-ajax="data-ajax" data-ajax-href="/user/5ca2ae5b86a604d9a65a45dd/follow_user" data-ajax-method="post" data-pa-name="follow_user" id="follow-user">Follow</a><a class="auth-required btn t-btn f-hide" data-ajax="data-ajax" data-ajax-href="/user/5ca2ae5b86a604d9a65a45dd/unfollow_user" data-ajax-method="post" data-pa-name="unfollow_user" id="unfollow-user">Following</a></div></div>

I am trying to select the user and follow that user by hitting the follower_user link.  In this case the user is paintedhanger.

I have a very basic understanding of html code so I have tried things like

Local $oIE = _IEAttach("website")
    _IELinkClickByText($oIE, "/user/5ca2ae5b86a604d9a65a45dd/follow_user")

or

Local $oIE = _IEAttach("website")
    _IELinkClickByText($oIE, "follow_user")

or

#include <Array.au3>
#include <Date.au3>
#include <IE.au3>
#include <File.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>




   local $userId = "5ca2ae5b86a604d9a65a45dd"

   Local $oIE = _IEAttach("website") ;attachs current IE webpage to program
   Local $oTitle = _IEPropertyGet ($oIE, "title" ) ;gets webpage title
   Local $oForm = _IEGetObjByID($oIE, $userid) ;grabs information of specific listing based on listing ID


   $colTags = _IETagNameGetCollection($oForm, "a")
   For $oTag In $colTags
       If $oTag.className = "follow" Then ;searches for share link
           $oFound = $oTag
           ExitLoop
       EndIf
    Next
   _IEAction($oFound,"click") ;clicks the follow button

the console either gives me a $_IESTATUS_NoMatch, or

--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (5ca54ecab50281c375851c75)
--> IE.au3 T3.0-2 Error from function _IETagNameGetCollection, $_IESTATUS_InvalidDataType
"test.au3" (19) : ==> Variable must be of type "Object".:
For $oTag In $colTags

I'm sorry I didn't provide more coding examples sooner.  I tried a bunch of misc other small things, but nothing seems to work, I am sure the answer is pretty simple and something dumb I am overlooking.

Link to comment
Share on other sites

  • Developers

@dbb1480, It took me a whole 2 minutes to find the website and their TERMS which between the shitload of verbiage also states: 

Quote

In connection with your use of the Service you shall not engage in or use any data mining, robots, scraping or similar data gathering or extraction methods. 

Wouldn't you say you are in violation with that with this script?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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