Selenium with Python Framework #12 | Implement Screenshot Utility
Nov 19, 2025âąChannel
AI Analysis
Data from YouTube Data API v3âąUpdated Just now
Video Overview
Video Details
Published6 months ago
Duration13:33
Video IDBS8wWXRth8M
Languageen
CategoryScience & Technology
PrivacyPublic
Made for KidsNo
Video TypeRegular Video
Performance Metrics
Views39
Likes2
Comments0
Engagement Rate5.13%
Likes per 100 views5.13
Comments per 1K views0.00
Video Tags
#selenium with python framework#selenium python screenshot utility#pytest screenshot on failure#selenium python take screenshot#python selenium automation framework#selenium pytest hooks#selenium python timestamp screenshot#selenium python tutorial#selenium python framework development#selenium save screenshot python#automation testing with python#sdet python selenium#selenium webdriver python#python automation testing#selenium python test failure screenshot
Description
Hello everyone! đ
Welcome back to the Selenium with Python Framework Series.
In Session #12, we will learn how to implement a complete Screenshot Utility inside your Selenium Python automation framework. This is a powerful feature used in real-time projects to capture screenshots automatically on test failures.
đ What You Will Learn in This Video
Why screenshot utilities are required in automation frameworks
How to create a screenshot utility file in Python
How to generate unique screenshot file names using timestamps
How to create screenshot storage folders automatically
Using os and datetime modules
Writing a reusable take_screenshot() function
Implementing pytest_runtest_makereport hook
Capturing screenshots only when a test fails
Accessing the WebDriver instance from failed tests
Demonstration with a purposely failing assertion to verify screenshot capture
TIMESTAMP
0:00 â Introduction to Session 12
0:08 â What is Screenshot Utility in Automation Framework
0:20 â Why We Need Screenshot Utility in Real-Time Projects
0:32 â Creating the Screenshot Utility Python File
0:50 â Importing Required Modules (os & datetime)
1:14 â Creating take_screenshot() Function
1:57 â Defining Screenshot Folder Name
2:38 â Creating Folder If Not Exists
3:36 â Generating Timestamp for Screenshot Names
4:22 â Formatting Timestamp Using strftime
4:47 â Creating Screenshot File Path
5:45 â Saving Screenshot Using WebDriver
6:11 â Print Screenshot Save Confirmation
6:34 â Using Pytest Hooks for Failure Screenshots
7:03 â Opening Test File & Adding Hook
7:16 â Adding pytest.hookimpl Decorator
7:39 â Creating pytest_runtest_makereport Function
8:11 â Waiting for Test Outcome
8:55 â Checking Test Status (Passed/Failed)
9:21 â Getting Driver Instance from Failed Test
10:06 â Calling Screenshot Utility on Failure
10:40 â Fixing Import Errors
11:10 â Creating a Test That Will Fail
11:57 â Running Test with Pytest
12:33 â Viewing Screenshot Output Folder
13:02 â Final Explanation & Summary
đ Code Concepts Covered
os.path.exists()
os.makedirs()
datetime.now()
strftime()
Pytest hook mechanism
File path building for screenshots
Saving images with .png format
Folder creation logic
Framework integration step-by-step
đž Real-Time Demo Included
This session shows:
â Creating the screenshot utility file
â Generating timestamped screenshot names
â Using f-strings for file paths
â Running Pytest with -v
â Triggering a failed test
â Automatically saving the screenshot inside /screenshots folder
â Verifying the final screenshot output
đ If You Found This Helpful
Please support the channel by:
đ Liking the video
đ Subscribing for more automation tutorials
đ Commenting your questions
đ Sharing with your testing community
#selenium #python #pytest #automationtesting #seleniumframework #pythonautomation #sdet #softwaretesting #testingfunda #qa #automationframework #seleniumwithpython #pytesthooks #codetutorials #automationengineer
Subscribe to our channel for the latest videos
==================================
https://www.youtube.com/c/TestingFunda
#selenium #tutorials #free #2022 #training
Watch more free Selenium Tutorials
https://www.youtube.com/watch?v=5hyEnZT9AkQ&list=PLBw1ubD1J1UjP1rZMbU8NSh2ajE12Yjjf
#JMeter #performance #testing #tutorials #free #2022 #training
Step-by-step free JMeter performance tutorials
https://www.youtube.com/watch?v=s33Bqz0vAUw&list=PLBw1ubD1J1UgVniCSUlg_LKRzlF11CZZB
#postman #API #testing #tutorial #manual #automation #free #2022 #training
Step-by-step free postman API manual and Automation Testing tutorials
https://www.youtube.com/playlist?list=PLBw1ubD1J1UgVniCSUlg_LKRzlF11CZZB
#java #programming #tutorials #free #2022 #training
Step-by-step free Java programming tutorials
https://www.youtube.com/watch?v=C8HRfmJ_ZZQ&list=PLBw1ubD1J1UjGNxe10eY-H7e9cQ12Qk_l
#cypress.io #automation #testing #tutorials #free #2022 #training
Step-by-step free cypress.io automation testing tutorials
https://www.youtube.com/watch?v=OvCLwh5vN8g&list=PLBw1ubD1J1Ujws5XLs7BGJqQkQVpJtmBJ
#agile #Youtube #series #free #2022 #training
Learn about agile from the free YouTube series
https://www.youtube.com/playlist?list=PLBw1ubD1J1Uif-cFY6BJRbjc3Ah9bKpSd
#learn #software #testing #innovative #animated #videos #free #2022
Learn software testing free from innovative animated videos
https://www.youtube.com/watch?v=jRcsuCrQI_s&list=PLBw1ubD1J1UhnuUX3Kd5OP5r9qaDHie-T