I'm trying to print out the title on youtube videos and when I print it out in my loop it only prints out the first element and I don't know why.
Here's my python code
s = Service('C:\webdrivers\chromedriver.exe')
driver = webdriver.Chrome(service=s)
driver.get("https://www.youtube.com/c/TechWithTim/videos?view=0&sort=p&flow=grid")
videos = driver.find_elements(By.CLASS_NAME, 'style-scope ytd-grid-renderer')
titles = []
for video in videos:
title = video.find_element(By.XPATH, './/*[@id="video-title"]')
print(title.text)