Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to iterate through a divs tag
#1
Hi
i would like to get an idea on how can i iterate through DIVs in code to get some data from each DIV.
my example is an amazon page results and would like to get some information from each item an store it in data structure (each item is contained in a div tag) ....the link below results items from Amazon
Reply
#2
see:
web scraping part 1
and
web scraping part 2
Reply
#3
try this method

You can loop through inner divs using jQuery .each() function. The following example does this, and for each inner div, it gets the id attribute.

$('#test').find('div').each(function(){
var innerDivId = $(this).attr('id');
});
Reply
#4
@LeanbridgeTech, this is python forum and OP is asking for python solution.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python selenium - get info from nested divs damian0612 3 13,106 Feb-26-2021, 08:58 AM
Last Post: law
  Web Crawler: How to find all divs that starts with... amandacstr 3 6,442 Oct-01-2016, 02:15 PM
Last Post: amandacstr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020