In [1]:
# Code attribution: Yiyin Shen, Tyler Caraza-Harter
# Imports
from selenium import webdriver
from selenium.webdriver.firefox.service import Service
import time
import matplotlib.pyplot as plt
In [2]:
# Take a screenshot of the page
service = Service(executable_path="geckodriver-win64/geckodriver.exe", log_output="log.txt")
driver = webdriver.Firefox(service=service)
url = "https://pages.cs.wisc.edu/~yw/CS320F23L19.html"
driver.get(url)
time.sleep(1)
driver.save_full_page_screenshot("screen_firefox.png")
plt.imshow(plt.imread("screen_firefox.png"))
Out[2]:
<matplotlib.image.AxesImage at 0x182164af210>
In [3]:
# Remember to quit when it's done
driver.quit()