С помощью селениума к примеру:
import matplotlib.pyplot as plt
%matplotlib inline
import os
import io
import cv2
import numpy
from PIL import Image
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
f,ax = plt.subplots(nrows=1, ncols=1, figsize=(21, 10))
options = webdriver.ChromeOptions()
options.add_argument('headless')
options.add_argument('start-maximized')
options.add_argument('window-size=1280x800')
driver = webdriver.Chrome(
executable_path=os.path.join('C:\\', 'Utils', 'chromedriver.exe'),
options=options
)
driver.get('https://yandex.ru')
screenshot = driver.get_screenshot_as_png()
size = (0, 0, 1280, 800)
image = Image.open(io.BytesIO(screenshot))
region = image.crop(size)
ax.imshow(region)