|The URL of the site is:
The information that I am trying to obtain is the price. Using Chrome's Inspect view, I was able to drill down to the price element in question. The Xpath of that element looks like:
/html/body/div/section/div/div/div/div/div/span/divI really wanted to see that in some "tree" form, so I walked the HTML backward from that element back to the top. That looks like:
<section role="main" id="main" class="app__Container-PDP__sc-9tcy1n-0 bglOQr">
<div class="style__ProductDetailsWrapper-PDP__sc-4buzay-0 fwCYaB">
<div class="style__Wrapper-PDP__sc-1a0l1ro-1 hiRMxh product-info">
<div class="style__ProductDescDeskWrapper-PDP__sc-1a0l1ro-6 fpGRzR">
<div class="style__ProductTitleWrapper-PDP__sc-1a0l1ro-11 fUmbqY">
<div tabindex="0" class="styles__PriceWrapper-sc-1c3t51u-0 ZQLLV priceWrapper">
<div class="sc-hGPBjI eomYbK">$30.65 </div>I was able to throw some Java code together (read: ugly) to drill down to that level but got stopped at the next-to-last
Elements elements = element.getElementsByAttributeValue("class", "style__ProductTitleWrapper-PDP__sc-1a0l1ro-11 fUmbqY");This returns a 1-item collection as it should. If I then follow that with:
Element element = elements.get(0);
elements = element.getElementsByAttributeValue("class", "styles__PriceWrapper-sc-1c3t51u-0 ZQLLV priceWrapper");It returns an empty collection. I assume this is because no such class could be found. However I can plainly see that
DIV element in the Inspect view.
I can get the sibling elements to the one in question. I even tried searching for
getElementsByAttributeValue("tabindex", "0"), and while it correctly found 2 elements, neither are the one I want.
Any idea(s) as to what I'm missing (or not understanding)?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 20-Jan-22 16:23pm.