How to take screenshot using Selenium in Python ? Last Updated : 30 Jun, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Selenium offers a lot of features and one of the important and useful feature is of taking a screenshot. In order to take a screenshot of webpage save_screenshot() method is used. save_screenshot method allows user to save the webpage as a png file. Syntax : driver.save_screenshot("image.png") Argument : filename or the full path you wish to save your screenshot to. Action performed : The screenshot will be saved in the same directory as the program, if path is provided screenshot will be saved at that location only. Code : Python3 # importing webdriver from selenium from selenium import webdriver from PIL import Image # Here Chrome will be used driver = webdriver.Chrome() # URL of website url = "https://www.geeksforgeeks.org/" # Opening the website driver.get(url) driver.save_screenshot("image.png") # Loading the image image = Image.open("image.png") # Showing the image image.show() Output : Comment More infoAdvertise with us Next Article How to take screenshots using python? R rakshitarora Follow Improve Article Tags : Python Web Technologies Practice Tags : python Similar Reads How to take screenshots using python? Python is a widely used general-purpose language. It allows performing a variety of tasks. One of them can be taking a screenshot. It provides a module named pyautogui which can be used to take the screenshot. pyautogui takes pictures as a PIL(python image library) which supports opening, manipulati 1 min read Take and convert Screenshot to PDF using Python In order to take and convert a screenshot to PDF, firstly the PyAutoGUI can be used which is an automation library in python which can control mouse, keyboard and can handle many GUI control tasks. Secondly, for the conversion PIL(Python Imaging Library) of python can be used which provides image pr 3 min read How to scrape multiple pages using Selenium in Python? As we know, selenium is a web-based automation tool that helps us to automate browsers. Selenium is an Open-Source testing tool which means we can easily download it from the internet and use it. With the help of Selenium, we can also scrap the data from the webpages. Here, In this article, we are g 4 min read How to Take Screenshot of a Div Using JavaScript? A screenshot of any element in JavaScript can be taken using the html2canvas library. This library can be downloaded from its official website. The below steps show the method to take a screenshot of a <div> element using JavaScript. ApproachIn this approach, we will create a blank HTML docume 2 min read screenshot() element method - Selenium Python Seleniumâs Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. To open a webpage using Selenium Python, checkout - Navigating links using get method â Selenium Python. Just bein 2 min read screenshot_as_png element method - Selenium Python Seleniumâs Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. To open a webpage using Selenium Python, checkout - Navigating links using get method â Selenium Python. Just bein 2 min read Like