I am trying to extract data from class using selenium but it is not working

HAPPY LAMMA

I need to scrape data from this website: https://www.daraz.pk/products/hy-i189662857-s1379994759.html?spm=a2a0e.searchlistcategory.list.3.70426378Fs3yJh&search=1

and html code for this is:

<div class="mod-reviews">
   <div class="item">...</div>
   <div class="item">...</div>
   <div class="item">...</div>
   <div class="item">...</div>
</div>

Each class div has 1 review and i want to extract it. I tried following code with selenium:

driver.get(site)
time.sleep(5)
data = driver.find_elements(By.CLASS_NAME,"item")

Hypothetically this should give me all item tags but for some reason this returns nothing. Am I missing something here?

Ohnemichel

These elements only appear after you scroll down the page for a while. Try to GUI-Automate that with a javascript injection like this

for i in range(25):
    driver.execute_script("window.scrollBy(0,100)")

Sadly, that scrolling does not work until you put your mouse cursor there, so there will other gui automation be necessary as well.

But wait! you can trick it:

for i in range(10):
    driver.execute_script("window.scrollBy(0,100)")
for i in range(10):
    driver.execute_script("window.scrollBy(0,-100)")
for i in range(25):
    driver.execute_script("window.scrollBy(0,100)")

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

I am trying to extract certain values from JSON data with NodeJS

Why am I getting unknown column in field list, I am trying to extract data from few columns

How do i extract data from yelp using selenium python

Trying to extract data from curly braces but not working

I am trying to select and click a button within a website using Selenium but there are multiple button with the same class

i am trying to retrieve the data from fire base database using recycler view but i am getting errors in it

I am trying to extract some data from espn as a table and getting it as list

I am trying to extract from text file data and add it into the audioread function Matlab

Code is not working when i am trying to edit the API URL by data entered in form and fetch data from API

Trying to extract values from aws-cli response using jq but failing, what am I doing wrong?

I am trying to extract tweets from a twitter query on Python using Twython

I am trying to extract the private exponent from the openssl command using a bash shell script

I am trying to select an image from a box and then click on the aligning button using selenium python

i am trying to pull text from a table on a jsp using page object selenium

I am trying to indent data when displaying using \t in swift but it isn't working

I am trying to create a map figure in python using Plotly but my data is not being imported or it is not properly working

Partial keyword match not working when I am trying to create a new column from a pandas data frame in python?

I am trying to render data from mongodb server to react app. And it's not working

I am trying to crawl a website using scrapy and storing the scraped data into variables of item class

I am trying to click on each link using selenium and python

i am trying to scrap website using selenium and beautiful soup

I am trying to search a keyword on youtube using Selenium in python

I am trying to launch chrome specific profile using python selenium?

I am trying to work out Minutes Per Goal using data from a data frame and the rows are printing wrong

How to to extract data from notam using selenium

Selenium error while trying to extract data from a web table

Hello i am trying to load a relative image using an array but it is not working

When I am trying to import XML from a URL this is not working correctly

I am trying to get images from other website but code is not working