1

I am trying to extract this website using VBA

This is the HTML I want to Target

<div class="claim"> <div num="1" id="US-6627754-B2-CLM-00001" class="claim">

to get data for various numbers, only constant things is

<div class ="claims" and class ="claim"

rest of the html is dynamic.

following code just works fine for first element.

oHtml.getElementsByClassName("claim").Item.innerHTML

for this case

oHtml.getElementsByTagName("div")(90).innerHTML

also gives desired result.

I don't have basic knowledge of HTML or VBA.

I know that this is not correct as it gives duplicate entry one for div class="claim" and other for class="claim" and div(90) is not always constant.

How to just target

<div class = "claim"

Tried oHtml.getElementsByTagName("div")(90).getElementsByClassName("claim").Item.innerHTML but did not gave results. For this specific website it is at div 90. again its not constant.

1 Answer 1

0

Have you tried finding ir by using the id as this is uniqe and can only be used once so you won't get duplicates ! On my phone atm so can't give eg if you need I will when on my computer! I'm studying both html and vba not a pro but I think I know what i'm doing!

Sign up to request clarification or add additional context in comments.

3 Comments

If I Understood it correctly, for Me, id is dynamic for different addresses. The only constant thing is <div class = claim>.
Really because when I have been coding recently I have used a class to style a range of elements and then a id to differ between them!!?
For me the id is unique for one set of data. I don't know what will be the data on lending page. So what I want is to get oHtml.getElementsByTagName("div")(90).getElementsByClassName("claim").Item.innerHTML to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.