Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6603751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:03:26+00:00 2026-05-25T19:03:26+00:00

Hello I am trying to extract the first href from within the title class

  • 0

Hello I am trying to extract the first href from within the “title” class from the following source (the source is only part of the whole page however I am using the entire page):

div id="atfResults" class="list results ">
<div id="result_0" class="result firstRow product" name="0006754023">
    <div id="srNum_0" class="number">1.</div>
        <div class="image">
        <a href="http://www.amazon.co.uk/Essential-Modern-Classics-J-Tolkien/dp/0006754023/ref=sr_1_1?ie=UTF8&amp;qid=1316504574&amp;sr=8-1">
        <img src="http://ecx.images-amazon.com/images/I/31ZcWU6HN4L._AA115_.jpg" class="productImage" alt="Product Details">
</a>
</div>
<div class="data">
    <div class="title">
<a class="title titleHover" href="http://www.amazon.co.uk/Essential-Modern-Classics-J-Tolkien/dp/0006754023/ref=sr_1_1?ie=UTF8&amp;qid=1316504574&amp;sr=8-1">Essential Modern Classics - The Hobbit</a>
        <span class="ptBrand">by J. R. R. Tolkien</span>
 <span class="bindingAndRelease">(<span class="binding">Paperback</span> -&nbsp;2 Apr 2009)</span>
        </div>

I have tried several variations of both the select function and also getElementByClass but all have given me a “null” value such as:

Document firstSearchPage = Jsoup.connect(fullST).get();
Element link = firstSearchPage.select("div.title").first();

If someone could help me with a solution to this problem and recommend some areas of reading so I can avoid this problem in future it would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:03:27+00:00Added an answer on May 25, 2026 at 7:03 pm

    The CSS selector div.title, returns a <div class="title">, not a link as you seem to think. If you want an <a class="title"> then you should use the a.title selector.

    Element link = document.select("a.title").first();
    String href = link.absUrl("href");
    // ...
    

    Or if an <a class="title"> can appear elsewhere in the document outside a <div class="title"> before that point, then you need the following more specific selector:

    Element link = document.select("div.title a.title").first();
    String href = link.absUrl("href");
    // ...
    

    This will return the first <a class="title"> which is a child of <div class="title">.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to extract data from this String: Hello there. Blah blahblah blah
Hello I am trying to extract a uk postcode from a string i.e. the
i am trying to extract the text abcdef from the following html using regex:
Hello I' trying to select from joined column: SELECT A.idAd, A.ads_in_Cat, A.title, A.currency, A.price,
Hello everyone I'm trying to improve my Java skills by solving some problems from
I am trying to extract the first letter of every word for a sentence
Hello i am trying to return a struct from a function but i cant
Hello Im trying to get the value of an element from a JsonObject. i'm
Hello I am trying to create a stacked barplot using the following code: test
Hello I'm trying to install maven plugin with eclipse and I have a following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.