Jump to content

how to find element or object by link


Go to solution Solved by bogQ,

Recommended Posts

how to find element or object by link 

this is the only information that i got: 

<a class="js-nav" href="/followbacklist3/followers" data-nav="followers" data-is-compact="false" data-element-term="follower_stats">Volgers<strong title="829">829</strong></a>

and i want to use this code with this function,showing the value the followers that is 829

$oIE = _IECreate("https://twitter.com/followbacklist3")

Local $oInputs = _IETagNameGetCollection($oIE, "a")
For $oInput In $oInputs
StringInStr($oInput.innertext, "volgers")

Next
MsgBox(0, "Twitter joesoef",$oInputs)

but this one is not working so i thought maybe i can track it with the link or something

Link to comment
Share on other sites

i am afraid i cant understand you.. you wana get the number value of the link.. you can reach the link be test it with your row stringinstr

after is you must use innerText in my opinian

and i think you can not typeout an objexct reference, because you oinput will be an object which point to an element of the element collection!

and and: if you have only 1 link you may use this code, but if you have more links(i dont know twitter) you must store in an array the values or you must put the writeout function inside the loop. and of course you have to remove the exitloop statement than! but only if you have more records to check..

$oIE = _IECreate("https://twitter.com/followbacklist3")

Local $oInputs = _IETagNameGetCollection($oIE, "a")
Local $sInnervalue=""
For $oInput In $oInputs
   if StringInStr($oInput.outerHtml, "volgers") then
      $sInnervalue=$oInput.innerText
      ExitLoop
   EndIf
Next
if $sInnervalue="" then consolewrite("There was no link!")
MsgBox(0, "Twitter joesoef",$sInnervalue)
Edited by vkrisz81
Link to comment
Share on other sites

 

i am afraid i cant understand you.. you wana get the number value of the link.. you can reach the link be test it with your row stringinstr

after is you must use innerText in my opinian

and i think you can not typeout an objexct reference, because you oinput will be an object which point to an element of the element collection!

and and: if you have only 1 link you may use this code, but if you have more links(i dont know twitter) you must store in an array the values or you must put the writeout function inside the loop. and of course you have to remove the exitloop statement than! but only if you have more records to check..

$oIE = _IECreate("https://twitter.com/followbacklist3")

Local $oInputs = _IETagNameGetCollection($oIE, "a")
Local $sInnervalue=""
For $oInput In $oInputs
   if StringInStr($oInput.outerHtml, "volgers") then
      $sInnervalue=$oInput.innerText
      ExitLoop
   EndIf
Next
if $sInnervalue="" then consolewrite("There was no link!")
MsgBox(0, "Twitter joesoef",$sInnervalue)

im very new at this sorry for not understanding,

could you please show me i can do this so i can learn and copy it on other project 

right now it is only showing  the tekst "volgers"

its not really about the link, i just want the followers number if there is a easier way please tell me

Edited by Arclite86
Link to comment
Share on other sites

See if this helps.

#include <IE.au3>

$oIE = _IECreate("https://twitter.com/followbacklist3")

Local $oInputs = _IETagNameGetCollection($oIE, "strong")
For $oInput In $oInputs
    ConsoleWrite($oInput.title & @LF)
Next

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Under ie8

 

#include <IE.au3>
#include <String.au3>
$oIE = _IECreate("https://twitter.com/followbacklist3")
$oInputs = _IETagNameGetCollection($oIE, "a")
For $oInput In $oInputs
    If $oInput.className() = "js-nav" Then
        If StringInStr($oInput.innerHTML()), 'Volgers') Then;or Followers depends withc language your using
            ConsoleWrite(_StringBetween($oInput.innerHTML(),'>','<')[0] & @CRLF);number of them
            ExitLoop
        EndIf
    EndIf
Next
edit: maybe i casted that string converts with no need but its my habit when working with ie, dont know why :P fixed Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Under ie8

 

#include <IE.au3>
#include <String.au3>
$oIE = _IECreate("https://twitter.com/followbacklist3")
$oInputs = _IETagNameGetCollection($oIE, "a")
For $oInput In $oInputs
    If $oInput.className() = "js-nav" Then
        If StringInStr($oInput.innerHTML()), 'Volgers') Then;or Followers depends withc language your using
            ConsoleWrite(_StringBetween($oInput.innerHTML(),'>','<')[0] & @CRLF);number of them
            ExitLoop
        EndIf
    EndIf
Next
edit: maybe i casted that string converts with no need but its my habit when working with ie, dont know why :P fixed

 

thank you I'm almost there, your code:

#include <IE.au3>

#include <String.au3>

$oIE = _IECreate("https://twitter.com/followbacklist3")

$oInputs = _IETagNameGetCollection($oIE, "a")

For $oInput In $oInputs

    If $oInput.className() = "js-nav" Then

        If StringInStr($oInput.innerHTML(), 'Volgers') Then;or Followers depends withc language your using

            ConsoleWrite(_StringBetween($oInput.innerHTML(),'>','<')[0] & @CRLF);number of them

            ExitLoop

        EndIf

    EndIf

Next

MsgBox(0, "number followers", $oInput.innerHTML)

i get the followers number which im very happy with, but I also get some other text that I dont want:

if i start this script i get the message: Volger<strong title="829">829</strong>

is there a way that I can remover al the text and only get the numbers ( 1x 829 not 2 times)

(volgers = followers in dutch   :) )

Link to comment
Share on other sites

  • Solution

look at scite console output and you will see that you already have code for that in script :P

MsgBox(0, "number followers", _StringBetween($oInput.innerHTML(),'>','<')[0]) :)

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

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