Click here to Skip to main content
15,884,898 members
Home / Discussions / Java
   

Java

 
GeneralRe: Switch from VB.Net to Java Pin
Gerry Schmitz5-Feb-22 18:27
mveGerry Schmitz5-Feb-22 18:27 
AnswerRe: Switch from VB.Net to Java Pin
jschell17-Feb-22 11:33
jschell17-Feb-22 11:33 
QuestionJAVA Pin
Ku Hazwan29-Jan-22 16:15
Ku Hazwan29-Jan-22 16:15 
AnswerRe: JAVA Pin
Dave Kreskowiak29-Jan-22 18:40
mveDave Kreskowiak29-Jan-22 18:40 
AnswerRe: JAVA Pin
jschell30-Jan-22 7:11
jschell30-Jan-22 7:11 
GeneralRe: JAVA Pin
Richard MacCutchan30-Jan-22 22:35
mveRichard MacCutchan30-Jan-22 22:35 
GeneralRe: JAVA Pin
jschell17-Feb-22 11:34
jschell17-Feb-22 11:34 
QuestionHow TO run the jar file in teradata ? Pin
Tauqeer Ahmad 202226-Jan-22 22:23
Tauqeer Ahmad 202226-Jan-22 22:23 
AnswerRe: How TO run the jar file in teradata ? Pin
OriginalGriff26-Jan-22 23:17
mveOriginalGriff26-Jan-22 23:17 
GeneralRe: How TO run the jar file in teradata ? Pin
Slacker00727-Jan-22 2:21
professionalSlacker00727-Jan-22 2:21 
GeneralRe: How TO run the jar file in teradata ? Pin
Tauqeer Ahmad 202227-Jan-22 3:59
Tauqeer Ahmad 202227-Jan-22 3:59 
AnswerRe: How TO run the jar file in teradata ? Pin
jschell30-Jan-22 7:18
jschell30-Jan-22 7:18 
GeneralRe: How TO run the jar file in teradata ? Pin
Tauqeer Ahmad 202230-Jan-22 23:39
Tauqeer Ahmad 202230-Jan-22 23:39 
QuestionLooping Array and Satisfying multiple conditions-Support Pin
Member 1551308825-Jan-22 22:01
Member 1551308825-Jan-22 22:01 
AnswerRe: Looping Array and Satisfying multiple conditions-Support Pin
Afzaal Ahmad Zeeshan5-Feb-22 11:40
professionalAfzaal Ahmad Zeeshan5-Feb-22 11:40 
QuestionPdf em java (PDF in Java) Pin
Daniel Carvalho 202221-Jan-22 1:54
Daniel 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
Daniel Carvalho 202224-Jan-22 5:53 
QuestionRe: Pdf em java (PDF in Java) Pin
David Crow24-Jan-22 6:06
David Crow24-Jan-22 6:06 
AnswerRe: Pdf em java (PDF in Java) Pin
Daniel Carvalho 202225-Jan-22 4:19
Daniel 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
David 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
Ricca Marie Fantilanan11-Jan-22 2:21 

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.