Welcome !
         

 GetElementsByClassName.GetElementsByTagName with Index number

Author Message
paydayphil

  • Total Posts : 3
  • Scores: 0
  • Reward points : 0
  • Joined: 2/16/2017
  • Status: offline
GetElementsByClassName.GetElementsByTagName with Index number Thursday, February 16, 2017 4:39 PM (permalink)
0
G'day,
         Im trying to get the TextContent from every td tag with index 1 in every tr in
a table with classname "az-facts" index 0 & also every b tag TextContent in the
same table & string them together side by side & create a new line. I can successfully
get the b tag TextContent. How do you do it ? I'd also like to make my own table with
2 columns & a new tr everytime I get both TextContent values. I've been at this for
a while now. Can someone please help ? Any other advice on my code would help me
to, thanks. Here is my code:
 
 
 
Sub GetData

     Set objIE = CreateObject("InternetExplorer.Application")
     objIE.Navigate "https://a-z-animals.com/animals/barracuda/"
   
   Do While objIE.Busy
     Delay 10
   Loop

     Set FactsB = objIE.Document.getElementsByClassName("az-facts")(0).getElementsByTagName("b")
     Set TdData = objIE.Document.getElementsByClassName("az-facts")(0).getElementsByTagName("tr")(0).getElementsByTagName("td")(1)

   For Each b in FactsB
     BNde = b.TextContent
   For Each x in TdData
     TdNde = x.TextContent
     right.InnerHtml = right.InnerHtml & BNde & space(1) & TdNde & "<br>"
   Next

     Set FactsB = Nothing
     Set TdData = Nothing
     objIE.Quit
   Next

End Sub
 
#1
    59cobalt

    • Total Posts : 2609
    • Scores: 253
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: offline
    Re:GetElementsByClassName.GetElementsByTagName with Index number Thursday, February 16, 2017 11:23 PM (permalink)
    0
    This forum is for new member introductions. Please post VBScript questions to the WSH & Client Side VBScript forum.
     
    #2
      paydayphil

      • Total Posts : 3
      • Scores: 0
      • Reward points : 0
      • Joined: 2/16/2017
      • Status: offline
      Re:GetElementsByClassName.GetElementsByTagName with Index number Friday, February 17, 2017 12:24 AM (permalink)
      0
      Sorry, will do. Thanks
       
      #3
        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2017 ASPPlayground.NET Forum Version 3.9