Question

I'm trying to find a specific text value in my HTML page

I'm trying to use the GetElementsByName ( as it does not have any ID )

x = msgbox("Wait for page to load",64, "Job ID")
JobId = IE.Document.GetElementsByName("jobId")
x = msgbox((JobId.Value),64, "Job ID")

here is the HTML and the value that I want to extract Please help THANKS !

enter image description here

No correct solution

OTHER TIPS

Try x = msgbox((JobId(0).Value),64, "Job ID")

When you use the GetElementsByName tag, it will be returning back an array. If you only have one item with that name tag, you can always use JobID[0] to reference it.

How ever if you are going to have more than one item, you will have to do some sort of loop

For Each job in JobID
  msgbox((job.Value),64, "Job ID")
Next

You could also do something like this

inputs = IE.Document.getElementsByTagName("input")
For Each input in inputs
  If input.type = "hidden" && input.name = "JobId" Then
     msgbox((input.Value),64, "Job ID")
  End If
Next
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top