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

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

Related Videos

More videos from Testing Funda by Zeeshan Asghar