Created
April 18, 2025 10:36
-
-
Save shmidtelson/ef0e1bb1695a5b5764dc6e06c2837e4b to your computer and use it in GitHub Desktop.
Screenshot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from seleniumwire import webdriver | |
def take_image(self, link: str): | |
options = webdriver.ChromeOptions() | |
options.add_argument('--headless') | |
options.add_argument('window-size=1280x720') | |
options.add_argument('--no-sandbox') | |
options.add_argument('--disable-dev-shm-usage') | |
try: | |
browser = webdriver.Chrome( | |
options=options, | |
) | |
browser.get(link) | |
result = browser.get_screenshot_as_png() | |
browser.quit() | |
return result | |
except Exception as e: | |
self.logger.error(f'{e}, link:{link}', exc_info=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment