I'm trying to get the values inside the div, after finishing a scroll in selenium. The scroll part works correctly, but I can't print the values of the div class.
My code:
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
s=Service('D:\enviroments\casino\chromedriver.exe')
driver = webdriver.Chrome(service=s)
url='https://www.casinoimportaciones.com.uy/accesorios-escola'
driver.get(url)
time.sleep(5)
# Get scroll height
last_height = driver.execute_script("return document.body.scrollHeight")
while True:
# Scroll down to bottom
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
# Wait to load page
time.sleep(5)
# Calculate new scroll height and compare with last scroll height
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == last_height:
driver.execute_script("window.scrollTo(0,-250);")
time.sleep(10)
elem2=driver.find_element(By.CLASS_NAME,"//div[@class='description']")
print(elem2)
time.sleep(100)
else:
last_height = new_height
Output error:
Update
Update: After fix find_element, he print a list of elements, but no the text: