jamescooper
Well-known Member
- Joined
- Sep 8, 2014
- Messages
- 840
Trying to pull the piece in bold below in the HTML for the following URL:
Cannot seem to work it with the following code.
Thanks.
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