Jump to content
UBot Underground

How To Select This Page Element ?


Recommended Posts

How to select this element ?

 

I want to select the element and click it, its always the last element before the "Next" element. The position/element number changes depending on the amount of pages but is always before the "Next" button.

 

So if its 32 pages it would be |32|Next.>

pMXRpJv.jpg

post-48321-0-06060300-1575578090_thumb.jpg

Link to post
Share on other sites

There are various ways to do this; I can explain one way - but its always best if you are able to include the website along with any code you have if you want somebody to be able to help.

 

What you can do is scrape the elements into a list and use the offset of the second to last element.

 

e.g. if there are 7 elements the list total is 7 and the offset for the second to last would be 5 (because offset starts at 0)

Link to post
Share on other sites

There are various ways to do this; I can explain one way - but its always best if you are able to include the website along with any code you have if you want somebody to be able to help.

 

What you can do is scrape the elements into a list and use the offset of the second to last element.

 

e.g. if there are 7 elements the list total is 7 and the offset for the second to last would be 5 (because offset starts at 0)

 

 

 

Ill give that a go an post the results thanks for that :)

 

Link to post
Share on other sites

Any help would be much appreciated

And I'm totally new to Ubot so I would grateful if you explain methods in as simple turns as possible :)

 

So I'm trying to select class="">2</a> to class="">10</a> add it to a list and then as you said offset it. Or run a largest number returned click element.

I can scrape the inner text and it returns the value of 2 for element with the number 2 in it. But if I select tag name it returns 460 so that's no good.

Basically I'm trying to navigate to the last page then post of a forum post on BHW

 

https://www.blackhatworld.com/seo/mass-parasite-backlinks-only-10-per-1000-link-in-post-25-per-1000-very-low-cost.1123322/

 

So this is my sudo code

 

Navigate to url

Look for Name Text Box

Enter name

Enter Password

Press login button

Scrape Element X (Page-(number(s))

Add (Page-(number) to list Y

Read List

Select highest (Page-(number) element

Click

 

Once I have this done I'll move on to finding the last post.

 

 

 

 

 

-------------------------- webpage code ---------------------------------------

 

<div class="PageNav" data-page="1" data-range="2" data-start="2" data-end="6" data-last="10" data-sentinel="{{sentinel}}" data-baseurl="blahblahblah.1123322/page-{{sentinel}}">
<span class="pageNavHeader">Page 1 of 10</span>
<nav>
<a href="blahblahblah.1123322/" class="currentPage " rel="start">1</a>
<a class="PageNavPrev hidden" style="">←</a> <span class="scrollable"><span class="items">
<a href="blahblahblah.1123322/page-2" class="">2</a>
<a href="blahblahblah.1123322/page-3" class="">3</a>
<a href="blahblahblah.1123322/page-4" class="">4</a>
<a href="blahblahblah.1123322/page-5" class="">5</a>
<a href="blahblahblah.1123322/page-6" class="">6</a>
</span></span> <a class="PageNavNext " style="">→</a>
<a href="blahblahblah.1123322/page-10" class="">10</a>
<a href="blahblahblah.1123322/page-2" class="text">Next ></a>
</nav>
</div>

Link to post
Share on other sites

So Ive managed to get to this point

 

%pages:
blhablahblahblah.1123322/page-2
blhablahblahblah.1123322/page-3
blhablahblahblah.1123322/page-4
blhablahblahblah.1123322/page-5
blhablahblahblah.1123322/page-6
blhablahblahblah.1123322/page-10

 

Which is a start lol !

 

Edited by ATuringtest
Link to post
Share on other sites

@ATuringtest

 

Give this a try!

 

loop(1) {
    set(#var,$scrape attribute($element offset(,0),"outerhtml"),"Global")
    set(#var2,$find regular expression(#var,"href=\"(.*?)\""),"Global")
    clear list(%targetURL)
    add list to list(%targetURL,$list from text(#var2,"
"),"Delete","Global")
    loop(6) {
        remove from list(%targetURL,0)
    }
    set(#var,"","Global")
    set(#var2,"","Global")
}

 

I tested this on several pages from that forum and it is pretty quick and efficient.

 

Buddy

  • Like 1
Link to post
Share on other sites

@ATuringtest

 

Give this a try!

 

loop(1) {

    set(#var,$scrape attribute($element offset(<class="PageNav">,0),"outerhtml"),"Global")

    set(#var2,$find regular expression(#var,"href=\"(.*?)\""),"Global")

    clear list(%targetURL)

    add list to list(%targetURL,$list from text(#var2,"

"),"Delete","Global")

    loop(6) {

        remove from list(%targetURL,0)

    }

    set(#var,"","Global")

    set(#var2,"","Global")

}

 

I tested this on several pages from that forum and it is pretty quick and efficient.

 

Buddy

 

Thanks @Ubotbuddy I'll give this a go as well :)

 

This is what I shrunk the code down to

 

set(#pages,$scrape attribute($element offset(<href=w"*/page-*">,6),"href"),"Global")

 

Theres no need for a list, the on page html ahref elements is the same no matter how many pages a thread has.

Edited by ATuringtest
  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...