I have done the following:
from selenium import webdriver
#Save a screenshot from spotify.com in current directory
DRIVER = 'chromedriver'
driver = webdriver.Chrome(DRIVER)
driver.get('https://www.youtube.com/watch?v=xzLu9AnuDAw&start=40&hd=0')
driver.save_screenshot('my_screenshot.png')
driver.quit()
The issue is that it takes the screenshot while the video is still loading at that frame(in this case of 40 seconds). I need screenshots of youtube at certain time frames.
I know this method takes screenshot of the website, and somehow the loading of youtube website gets completed before the video is loaded.
Is there a way that I can instruct selenium to wait for, say 2 seconds, before capturing the screenshot?