Python Forum

Full Version: screenshot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to take picture from page in different size(picture must be responsive)
i do not want use api.
the api that there is in this site( is good ,and i want to use code that work same.
And your question is? You want to write code that do the same? You want to use their API? Something else?
What have you tried so far? Post your code in python tags, full traceback - if you get one - in error tags.
yes,i want to write code to take picture from page in define size.(mobile size and desktop size)

from selenium import webdriver
from import Options
import time

# Provide a list of urls to create screenshots from
link = ''

# The Chrome and ChromeDriver Paths will vary based on your Operating System.
# This example shows how to configure ChromeDriver for Mac
CHROME_PATH = '/usr/bin/google-chrome-stable'
CHROMEDRIVER_PATH = '/home/arezoo/Desktop/chromedriver'

# Set the Browser Size
WINDOW_SIZE = "320,480"

# Configure Chrome Options
chrome_options = Options()
chrome_options.add_argument("--window-size=%s" % WINDOW_SIZE)
chrome_options.binary_location = CHROME_PATH

driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH,

# Loop through the list of urls and save the screenshot


# sleep for 2 seconds to allow the page to fully load.

# create a clean filename from the url
str = link.split('://')[1]
filename = str.replace('/', '__')
image = filename.replace('.', '_') + ".png"

# save the screenshot

# Close Selenium
If you continue like this, it will be very difficult to get real help. What is the problem with that code? Describe your specific problem and ask specific questions...