Skip to content

Instantly share code, notes, and snippets.

@Chalarangelo
Created October 28, 2017 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chalarangelo/50818a3f9e3c13aaf52297d41f79f987 to your computer and use it in GitHub Desktop.
Save Chalarangelo/50818a3f9e3c13aaf52297d41f79f987 to your computer and use it in GitHub Desktop.
import time
from selenium import webdriver
url = "https://unsplash.com"
driver = webdriver.Firefox(executable_path=r'geckodriver.exe')
driver.get(url)
driver.execute_script("window.scrollTo(0,1000);")
time.sleep(5)
# Select image elements and print their URLs
image_elements = driver.find_elements_by_css_selector("#gridMulti img")
for image_element in image_elements:
image_url = image_element.get_attribute("src")
print(image_url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment