Is there anyone who is familar with HTML DOM data scraping and DOM navigation using VBA, that could give me a hand with parentnode and childnode syntax?
I have a website that contains the columns: No, Date, Updated, Request Type, Request Detail, Latest Notes, Client, Status, Priority, Alert Level, Tech, Location and URL I am looking to data scrape.
The Status column can contain a variety of different values as can the Tech.
My goal is to identify every ticket containing "Equipment to Site" in the "Status" column and then to grab the ticket number for that row, which occurs two objects (tags) up in the hierarchy. I'd like to then write those ticket numbers to an array variable so that I can loop through and recall those ticket numbers later in my code.
Concurrently I'd also like to check the tech name for each Equipment to Site row and if the tech assigned the ticket isn't me to write the ticket number to a different array variable, so I that I can then automate going to each of those ticket pages to reassign the ticket to myself.
The Tech data is below the Equipment to Site in a the third TD tag structure from the Equipment to Site TD object and then down another seven objects down from there.
The parentnode and childnode are new to me and while I've found different examples on the web that demonstrate its use, I don't yet have the syntax correct, which is leaving me with an empty variable (I used a single dimension variable for testing purposes).
As my opening gambit I am using this code to loop through and find each of the "Equipment to Site" objects on the HTML page. Part of the problem may be that I am not properly using the Tagx to then try and call a parentnode or childnode.
If there is anyone who might be able to help me with the proper syntax for parent and child node, I'd really be very grateful to you.
I've included screenshots of the HTML code (I figured it was easier to see the structure this way with the indentations that way) and what the page with the columns look like.
http://staffweb.psdschools.org/mway/excelquestion/screen capture 1.png - Screenshot of Web Page
http://staffweb.psdschools.org/mway/excelquestion/screen capture 2.png - HTML Code
Thank you so very much!
-Matt-
I have a website that contains the columns: No, Date, Updated, Request Type, Request Detail, Latest Notes, Client, Status, Priority, Alert Level, Tech, Location and URL I am looking to data scrape.
The Status column can contain a variety of different values as can the Tech.
My goal is to identify every ticket containing "Equipment to Site" in the "Status" column and then to grab the ticket number for that row, which occurs two objects (tags) up in the hierarchy. I'd like to then write those ticket numbers to an array variable so that I can loop through and recall those ticket numbers later in my code.
Concurrently I'd also like to check the tech name for each Equipment to Site row and if the tech assigned the ticket isn't me to write the ticket number to a different array variable, so I that I can then automate going to each of those ticket pages to reassign the ticket to myself.
The Tech data is below the Equipment to Site in a the third TD tag structure from the Equipment to Site TD object and then down another seven objects down from there.
The parentnode and childnode are new to me and while I've found different examples on the web that demonstrate its use, I don't yet have the syntax correct, which is leaving me with an empty variable (I used a single dimension variable for testing purposes).
As my opening gambit I am using this code to loop through and find each of the "Equipment to Site" objects on the HTML page. Part of the problem may be that I am not properly using the Tagx to then try and call a parentnode or childnode.
Code:
'Look At Only Element Types Of DIV
Set Tags = IE.Document.getElementsByTagName("div")
'If The DIV Button Is Title Named Equipment to Site, Then...
For Each Tagx In Tags
If Tagx.getAttribute("title") = "Equipment to Site" Then
Variable = Tagx.ParentNode.getAttribute("update-container-id")
End If
Next
If there is anyone who might be able to help me with the proper syntax for parent and child node, I'd really be very grateful to you.
I've included screenshots of the HTML code (I figured it was easier to see the structure this way with the indentations that way) and what the page with the columns look like.
http://staffweb.psdschools.org/mway/excelquestion/screen capture 1.png - Screenshot of Web Page
http://staffweb.psdschools.org/mway/excelquestion/screen capture 2.png - HTML Code
Thank you so very much!
-Matt-

Last edited: