Want to capture gif-animation when running Browser-tests in Docker container

204 views
Skip to first unread message

Bela Borbely

unread,
Nov 22, 2023, 5:29:56 PM11/22/23
to robotframework-users
Hi,

I am quite new to both Robot Framework and Browser library too. 
I am impressed of the active community and the capabilities of tools!

I would like to capture gif animations from the test run.  (Would be some kind of living (visual) specification too).  As I understood ScreenCapLibrary has this possibility: Start Gif Recording 
  1. If I run tests in headless mode I get this error: "ScreenShotError: $DISPLAY not set."
  2. If I run test not in headless mode, I get this error: "Looks like you launched a headed browser without having a XServer running.  Set either 'headless: true' or use 'xvfb-run <your-playwright-app>' before running Playwright."
Can you recommend the easiest way to could capture gif (or even video) in Docker container without real monitor? Is it even possible?

I am also wondering how is it possible to run tests in headless mode and get png screenshots. I can, it is a basic thing in Robot Browser. Is gif-capturing so different than taking png screenshots?

Thank you in advance!
Cheers, Béla

Tatu Aalto

unread,
Nov 23, 2023, 12:52:25 AM11/23/23
to bela.z....@gmail.com, robotframework-users
Hi

Welcome to the community.

With Browser library, gif is not possible out of the box, but you can record a video. From the New Context keyword see the recordVideo argument. This is inbuilt and will work with headless mode too.

-Tatu


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/af66acae-fbb6-4860-9b00-7ac40eef3718n%40googlegroups.com.

Bela Borbely

unread,
Nov 23, 2023, 6:17:02 AM11/23/23
to robotframework-users
Thank you, Tatu!

Awesome, it is easier than I have expected!
Can I embed the video somehow into the report log.html and affect the name of the videos?  

Tatu Aalto

unread,
Nov 23, 2023, 6:21:42 AM11/23/23
to bela.z....@gmail.com, robotframework-users
Hi

You can find the embedded video in the New Page keyword automatically.

If you are using video for debugging purposes, then it might be useful to look also at the trace.

-Tatu


Bela Borbely

unread,
Nov 23, 2023, 6:38:45 AM11/23/23
to robotframework-users
Double awesomeness! Thank you very much, this is exactly what I was looking for!
Terveisin, Béla
Reply all
Reply to author
Forward
0 new messages