Jump to content



Photo

How To Extract The Innertext Of The Following Example?


  • Please log in to reply
7 replies to this topic

#1 ThomasAJ

ThomasAJ

    Member

  • Members
  • PipPip
  • 10 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Professional Edition

Posted 13 February 2018 - 05:57 AM

I have tried many ways to extract the innerText from the following but I cannot. The attachment shows the rudimentary nodes.

 

The Advanced Element Editor for that class is here...

 

<div class="competitor-details">
                      <div class="racing-details">
                        <div class="competitor-info__main">
                        <span class="competitor-info__horse-name horse-hover-trigger hover-trigger--509635" data-sid="509635">
                          <a href="https://www.punters....rapeze_509635/"rel="Flying Trapeze's Profile">
                            <span class="competitor-number">1.&nbsp;</span>
                          Flying Trapeze
                            <span class="competitor-info__barrier-number">(2)</span>
                          </a>
                        </span>
                        </div>
                            
                              <span class="competitor-info__jockey-name">
                                  <b>J:</b>
                                  <a href="https://www.punters....-bayliss_3277/"rel="Jake Bayliss's Profile">Jake Bayliss</a>
                                58.5kg
                              </span>
                      </div>
                    </div>
 
Thank you

Attached Files



#2 LoWrIdErTJ - BotGuru

LoWrIdErTJ - BotGuru

    Botguru.net

  • Moderators
  • 4578 posts
  • LocationMichigan
  • OS:Windows 10
  • Total Memory:8Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 13 February 2018 - 12:53 PM

attribute to scrape from screenshot set to inner text


Web Automation Bots, and Ubot Plugins @ BotGuru.net Want a Custom bot? click here or Email me

ForumBanner.png

21 PLUGINS ABSOLUTELY FREE 100s for commands and functions
 


#3 ThomasAJ

ThomasAJ

    Member

  • Members
  • PipPip
  • 10 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Professional Edition

Posted 13 February 2018 - 09:13 PM

Thank you BotGuru.

 

Yes I was missing the innertext attribute.

 

But after I enter it there is only 1 entry in the list horses and it is the first horse/jockey but I know there are 40+ such identical classes. (I do some web programming and know how to interpret HTML, CSS etc)

 

Here is the source code.

 

navigate("https://www.punters....nd/2018-02-14/","Wait")
clear list(%horses)
add list to list(%horses,$scrape attribute($element offset(<class="competitor-details">,0),"innertext"),"Don\'t Delete","Global")

 

Thanks in advance



#4 LoWrIdErTJ - BotGuru

LoWrIdErTJ - BotGuru

    Botguru.net

  • Moderators
  • 4578 posts
  • LocationMichigan
  • OS:Windows 10
  • Total Memory:8Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 14 February 2018 - 05:02 AM

remove the element offset that is setting position 0 (its index based first one will start at 0)

 

and just use the <class="competitor-details"> instead of element offset


Web Automation Bots, and Ubot Plugins @ BotGuru.net Want a Custom bot? click here or Email me

ForumBanner.png

21 PLUGINS ABSOLUTELY FREE 100s for commands and functions
 


#5 ThomasAJ

ThomasAJ

    Member

  • Members
  • PipPip
  • 10 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Professional Edition

Posted 14 February 2018 - 06:38 PM

Thanks TJ

 

But I am unclear exactly what you mean by the above.

 

When I set offset to "" like so "add list to list(%horses,$scrape attribute($element offset(<class="competitor-details">,""),"innertext"),"Don\'t Delete","Global")"
I get a run-time error.

 

Error: Conversion from string "" to type 'Integer' is not valid.

 

I have tried all sort of combinations of remove the word 'offset' and adjusting the following delimiters like '(', ')', ',' in the Source View but I then get code errors. Squiggly red underlines.

 

I'm stuck.

 

Can you please alter my 'add list to list' code to demonstrate exactly how it should be.

 

EDIT:
If anyone wants to run the code just change the date at the end of the Navigate URL to current or next day. The date format is yyyy-mm-dd and then select a race from the WHERE drop-down list.


Edited by ThomasAJ, 14 February 2018 - 06:46 PM.


#6 ThomasAJ

ThomasAJ

    Member

  • Members
  • PipPip
  • 10 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Professional Edition

Posted 15 February 2018 - 02:04 AM

I may know what the problem is (or not)?

 

So I add '$scrape attribute' to 'List To Add' as shown below (all normal and it is identical to what I see in the learning videos) 

 

UbotNoElementOffset.jpg

 

Then I use '<>' to carefully select the DIV that surrounds the innertext that I want to scrape BUT the '$element offset' gets inserted automatically as shown below.

 

UbotElementOffset.jpg

 

This automatic insertion of '$element offset'  does not occur in learning videos at UBOT and it is not required according to TJ in his prior post.

The class that I am after is correct.

PLEASE IGNORE EMPTY 'Attribute To Scrape' in the picture. I have it there when running the bot.

 

I have the latest UBOT.

 

EDIT: In the top picture if I type in <class=competitor-details> into 'Element To Scrape' and select the Attribute To Scrape from the drop down and hit OK I get an 'Invalid Parameter' error message.


Edited by ThomasAJ, 15 February 2018 - 02:11 AM.


#7 LoWrIdErTJ - BotGuru

LoWrIdErTJ - BotGuru

    Botguru.net

  • Moderators
  • 4578 posts
  • LocationMichigan
  • OS:Windows 10
  • Total Memory:8Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 15 February 2018 - 07:52 AM

add list to list(%horses,$scrape attribute(<class="competitor-details">,"innertext"),"Don\'t Delete","Global")

 

note just removed the element offset


Web Automation Bots, and Ubot Plugins @ BotGuru.net Want a Custom bot? click here or Email me

ForumBanner.png

21 PLUGINS ABSOLUTELY FREE 100s for commands and functions
 


#8 ThomasAJ

ThomasAJ

    Member

  • Members
  • PipPip
  • 10 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Professional Edition

Posted 16 February 2018 - 02:03 AM

Thank you - perfect.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users