Skip to content
Advertisement

Incomplete scrapped data from shopee.co.id using BeautifulSoup and Selenium

I am trying to scrape shopee.co.id using beautifulsoup and selenium. There are 60 product in a single search results page. At the end of the code, I checked the extracted data using len() and it shows that I only extracted 42 of them. How should I fix the code to obtain all the search results?

Here is the code that I’ve been trying:

JavaScript

Advertisement

Answer

This is one way you can get those product details (selenium setup is chrome/linux, you can adapt the code to your own setup, just see the imports and the code after defining the browser):

JavaScript

This will print out in terminal:

JavaScript

You can dissect those json objects further, to extract the data you need.

Advertisement