HTML VBA p tag

jamescooper

Well-known Member
Joined
Sep 8, 2014
Messages
841
Trying to pull the piece in bold below in the HTML for the following URL:

Code:
[URL]https://www.tesco.com/groceries/en-GB/shop/fresh-food/all?include-children=true&page=1[/URL]

HTML:
<div class="tile-content" id="tile-253558119" data-auto-id="253558119"><div class="product-tile-actions--has-no-text"></div><a href="/groceries/en-GB/products/253558119" aria-hidden="true" class="product-image-wrapper" tabindex="-1"><div class="product-image__container"><img src="https://img.tesco.com/Groceries/pi/594/0000003023594/IDShot_225x225.jpg" alt="Tesco Cauliflower Each" class="product-image grayscale" srcset="https://img.tesco.com/Groceries/pi/594/0000003023594/IDShot_90x90.jpg 768w,https://img.tesco.com/Groceries/pi/594/0000003023594/IDShot_225x225.jpg 4000w"></div></a><div class="product-details--wrapper"><div class="product-details--content"><h3 class="sc-dnqmqq kMWCPS"><a href="/groceries/en-GB/products/253558119" class="sc-htoDjs kRdgZa" data-auto="product-tile--title">Tesco Cauliflower Each</a></h3></div><div class="product-details--content"></div><div class="product-details--content"><a href="/groceries/en-GB/reviews/submission/253558119?from=%2Fshop%2Ffresh-food%2Fall%3Finclude-children%3Dtrue" aria-label="Write a review for Tesco Cauliflower Each" class="icon-chevron_right-link sc-gzVnrw eZwZib" data-auto="review-link">Write a review</a><div class="product-info-message-section unavailable-messages"><div data-auto="info-message" class="product-info-message with-warning-background"><p class="">Sorry, this product is currently unavailable</p></div></div></div></div>


Cannot seem to work it with the following code.

Thanks.

Code:
Set topics2 = html.getElementsByClassName(".product-info-message.with-warning-background")


j = 1


For Each topic In topics2
Set titleElem = topic.getElementsByTagName("div")(0)
Sheets(1).Cells(j, 2).Value = titleElem.getElementsByTagName("p)(0).innerText
LastRow2 = Cells(Rows.Count, "B").End(xlUp).Row
j = 1 + LastRow2


Next
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,225,739
Messages
6,186,738
Members
453,369
Latest member
juliewar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top