Click here to Skip to main content
15,445,997 members
Home / Discussions / Java
   

Java

 
QuestionPdf em java (PDF in Java) Pin
Daniel Carvalho 202221-Jan-22 1:54
MemberDaniel Carvalho 202221-Jan-22 1:54 
AnswerRe: Pdf em java (PDF in Java) Pin
OriginalGriff21-Jan-22 2:00
mveOriginalGriff21-Jan-22 2:00 
GeneralRe: Pdf em java (PDF in Java) Pin
Daniel Carvalho 202224-Jan-22 5:53
MemberDaniel Carvalho 202224-Jan-22 5:53 
QuestionRe: Pdf em java (PDF in Java) Pin
David Crow24-Jan-22 6:06
MemberDavid Crow24-Jan-22 6:06 
AnswerRe: Pdf em java (PDF in Java) Pin
Daniel Carvalho 202225-Jan-22 4:19
MemberDaniel Carvalho 202225-Jan-22 4:19 
AnswerRe: Pdf em java (PDF in Java) Pin
Richard Deeming25-Jan-22 5:10
mveRichard Deeming25-Jan-22 5:10 
GeneralRe: Pdf em java (PDF in Java) Pin
englebart12-Feb-22 14:40
professionalenglebart12-Feb-22 14:40 
QuestionGetting data from a web site using Jsoup Pin
David Crow20-Jan-22 4:59
MemberDavid Crow20-Jan-22 4:59 
The URL of the site is:

https://www.lowes.com/pd/7-16-CAT-PS2-10-OSB-Sheathing-Application-as-4-x-8/50382768[^]

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[3]/section/div/div[7]/div[1]/div[2]/div[1]/span/div[1]
I 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:
<html>
  <body>
    <div id="app">
      <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">
                  <span class="finalPrice">
                    <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 DIV element.
// a bunch of other calls to getElementsByAttributeValue()
...
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)?

Thanks.
DC

"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.

AnswerRe: Getting data from a web site using Jsoup Pin
englebart12-Feb-22 14:44
professionalenglebart12-Feb-22 14:44 
Questionjava program Pin
Ricca Marie Fantilanan11-Jan-22 2:21
MemberRicca Marie Fantilanan11-Jan-22 2:21 
AnswerRe: java program Pin
Richard MacCutchan11-Jan-22 2:40
mveRichard MacCutchan11-Jan-22 2:40 
AnswerRe: java program Pin
Member 1550241316-Jan-22 23:01
MemberMember 1550241316-Jan-22 23:01 
GeneralRe: java program Pin
Pete O'Hanlon16-Jan-22 23:18
mvaPete O'Hanlon16-Jan-22 23:18 
GeneralRe: java program Pin
Richard MacCutchan17-Jan-22 0:39
mveRichard MacCutchan17-Jan-22 0:39 
AnswerRe: java program Pin
Prashanth Rao 202118-Jan-22 23:18
MemberPrashanth Rao 202118-Jan-22 23:18 
Questionhow do i properly connect my external style sheet link to my jsp page. Pin
jonathanIckovich25-Dec-21 19:42
MemberjonathanIckovich25-Dec-21 19:42 
QuestionWhat is causing error in my merge sort java code? Pin
Vivek Halakatti3-Dec-21 5:20
MemberVivek Halakatti3-Dec-21 5:20 
AnswerRe: What is causing error in my merge sort java code? Pin
Richard MacCutchan3-Dec-21 6:09
mveRichard MacCutchan3-Dec-21 6:09 
QuestionWhat may be the error in this java ->merge sort code? Pin
Vivek Halakatti2-Dec-21 7:15
MemberVivek Halakatti2-Dec-21 7:15 
AnswerRe: What may be the error in this java ->merge sort code? Pin
Richard Deeming2-Dec-21 21:29
mveRichard Deeming2-Dec-21 21:29 
QuestionWhy am I getting an error concatenating a String in java 16? Pin
Toml61828-Nov-21 6:13
MemberToml61828-Nov-21 6:13 
AnswerRe: Why am I getting an error concatenating a String in java 16? Pin
Gerry Schmitz28-Nov-21 7:58
mveGerry Schmitz28-Nov-21 7:58 
QuestionRe: Why am I getting an error concatenating a String in java 16? Pin
Richard MacCutchan28-Nov-21 8:13
mveRichard MacCutchan28-Nov-21 8:13 
AnswerRe: Why am I getting an error concatenating a String in java 16? Pin
Toml61828-Nov-21 9:55
MemberToml61828-Nov-21 9:55 
Questionhelp with 2d cellular automata in JavaSwing Pin
Suave6519-Nov-21 9:10
MemberSuave6519-Nov-21 9:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.