How to take a screenshot in selenium using python?

Taking a screenshot in selenium is one of the most useful features. It’s a pretty straight forward process.

Syntax

1. Open a python file and name it as selenium_screenshot_syntax.py and add the following code.

By default, the screenshot is saved in the same folder/directory as the program folder. Alternatively, you can provide a different location to save your screenshot.

Full Code for screenshot

Scroll to Top