Workaround to record video in Selenium headless mode, including when using Selenium Gri #2897
                  
                    
                      testervippro
                    
                  
                
                  started this conversation in
                Ideas
              
            Replies: 2 comments 9 replies
-
| What is the point of running a headless browser inside a container? | 
Beta Was this translation helpful? Give feedback.
                  
                    7 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
How to Record Video in Selenium Headless Mode (Works with Selenium Grid)
By default, when using:
in Selenium—especially with Selenium Grid—you may get a completely black video. This happens because Chrome in headless mode doesn’t render a visible UI for the screen recorder to capture.
Workaround I Found (Tested)
Although it’s not the perfect solution, here’s a working approach:
Key Details
Example: If the test runs for 10 seconds → record ~10 seconds of screenshots
Demo Available
You can try a working example in this GitHub repository:
https://github.com/testervippro/selenium-headless-mode-demo
Other frameworks like Cypress and Playwright already make it much easier to record videos, even in headless mode. It would be great to see Selenium catch up in this area.
Beta Was this translation helpful? Give feedback.
All reactions