Вопрос решила, можно сделать вот так:
import urllib
from selenium import webdriver
import random
import urllib.request
url = input()
driver = webdriver.Chrome()
driver.get(url)
with open('filename.png', 'wb') as file:
file.write(driver.find_element_by_xpath('//*[@id="profile_photo_link"]/img').screenshot_as_png)
driver.close()