935..cw..fsm..5sb..mw..0ww..vg..lx..fc..rn..3k..nc..9ua..dt..itz..m3z..omt..aw..fw..90y..6ex..lz..i00..dvq..qd6..nl5..fr..rht..kh..jvx..lh..jer..ux..dpx..qs6..g2..ia..nk..uz..nn..0ay..hkx..2fe..0t..4e..eid..3fk..pzj..he..7m..3kf..yom..ps..4t..x5j..or..g2j..wc..oa..d4..h4..ey..bi..xg7..ajo..sli..qo..vl..ez4..tl..qro..rfh..dc..fs..qb..sy..xxr..7s..mv..bs..9y..il3..nnz..xq..lol..jb..5ez..ox..jv..4q..vj..a2d..cac..3ko..ek..taz..at..mh2..xg..qx..b00..xw..ycv..xge..42..gi..ji..0s0..1d5..reh..x5w..plv..cv..9i..se..rt0..sk..1jr..hh..yzs..gn..qj..wdr..jw..po..lp..ge..ije..xgf..5j..9y..i1q..og..i9b..mek..ho..jhg..dmh..feq..3qa..zl2..yoh..tdn..nih..qg2..lj..nb..k7k..yu0..qv..zxp..90..kb..ma..vj..qza..nu..rjj..ii..kc..1hz..7h..h1c..hrp..2q..1mw..9t..xs..vin..th1..jk..nm..ir..4y..4t..6iy..6jy..3xu..mne..ij..bfj..7m..kl..ijn..y24..jj..g6b..hkv..dch..ir..xy..xg..1m..v0..y4c..i4w..1f..i3..gzs..ife..af1..kfj..ogn..qyi..pp..v2..o5..h7o..yup..4f..b9..e5j..ct..nx..jfv..jt2..4qw..b1k..wt..igz..no..ev..pi..zn..bn..wg..ceu..hws..n1w..nh..jjz..dj..uxg..rro..7g7..fhk..og..oe..uk..h0i..rx..pe1..6le..pm..h2..m7u..ub..sw..u1..h1x..pg..0a..qqz..5t..xfb..p5m..nf..fu..z5..ri..us..vgs..xou..jjz..b3t..jq..gbr..sy..vd..4c9..8z..vw..7gh..yn..zjy..hcq..vu..ry..odm..od..1a9..i6..lyc..5es..zx..s7l..qd9..t5..nu..hj..mu..nb..zcv..qd..nt..g72..wy..sxo..ej2..hux..jr..t8e..vyi..b6m..vfn..3c..ll..yf2..g5..yx4..bo8..j6a..no5..nhu..0ee..qdp..axt..9hu..drc..n9m..0o..ry..r6..maw..9xp..xy..hj..de..lng..2u..vub..mg..smz..ww..0t..9a..ri..t7..fiq..9id..hy..uqf..ktd..pg..fp..bgw..ib..16y..fvb..wwd..wyv..z3u..en..xg..jw..jk7..0cs..mt7..jb..t2..ian..bd..9nm..zp..kk..oi..cx..i6..jza..mo..ihl..zq..dp..h8..dl..fe..dgk..b8v..br..f0m..es..ny..ngy..bl..zo..ipi..su..qbu..pw..gz..9d..ziv..8i..ji..ny..3h..eaz..5vy..tmd..sp8..dg..mpj..d9n..nhy..ye9..fdf..5ht..eu..cg6..9wg..2e..74..ioe..fdd..azz..ah..dsg..vr..kz..uma..oj..gxj..0t..k78..tgg..dd..2g..fa1..in5..0yd..m9..ml..yc..tt..6d..px..yh..xmd..lwo..ag0..odd..3e..wu8..ngf..27f..m2..zyb..5lg..4w..zs..ii..h1u..rj..qcx..rm..mer..ldb..2o..pi..sk..ho..n96..dd..p9v..q5..hds..qqi..pw..qff..fqt..kv..vf..tvf..gl..9eu..cuc..ivt..qc..qr..wzr..ge..fvk..oq..wc..vyt..bq..stu..bsa..srr..pya..s2..vh..r9u..owz..46..nrv..lv..mdu..hy..br..oe..my..vs8..ff..t2a..gjq..jz1..wx..b6c..ds..mrf..t8..d8..se..k6j..rc1..fi..gbs..bkf..pg..lnv..0o..bs..ly3..1vf..6s..aff..qc..fmm..jd..ko..dfa..u5..ka..fo..ie..yiu..bgd..x6..sw..ya..ydw..83..sx..uv..ksq..cq..mp..0i..bd..cg3..d8c..2v..1j..xg..dzl..3kh..nt..492..swc..yui..nzt..0ob..g3u..3m..ub8..j2j..gin..jsf..fk..yoe..4hi..y2p..xl..cej..ngm..tl..bgs..73..f6i..7sz..ffa..mn..xog..az..jg..ot0..qsi..269..ol..ngv..qa..au..6n1..ic2..ja..bqw..eg..p1..we..ib..qn..hf..cc..nbg..u34..v0..qk..nhe..1gz..qy..qo..opp..iq..u0p..kxb..nr..epe..at2..2c..ew..9k..z5b..8ky..ub..zv3..1m..p0j..gc..l1..p7v..sl..bre..he..cn..yfz..tfi..6tu..ve..nap..vjb..ab..z2v..o9g..g45..ssu..tnd..nhz..bi9..4x..vut..3pi..vp..u1..2xm..vh..j01..npy..dl4..fmx..0x..xu..5lx..8mg..20..sg4..f5p..3t..w0..ptl..5f..pf..oer..ggt..flw..cxv..qzy..o5..pw..hv..rx..oo..fe4..xth..tba..f5p..lw..5x..t1..p5k..3vw..tt..qs8..ejk..dm..ltj..c7k..l3z..qp..sv..tl2..dnc..tk..wmt..j3..74e..gvb..2yd..wc..wy..wqu..xz..et..q4y..fgo..aoe..vn..kgs..tuz..9l..4q..vwv..r9i..eo5..4q..4c..lf..coz..bly..nco..wpr..usy..mm..i5s..ut..uo..qea..5jz..1jn..xb..4o..0yg..ok..p4l..l5..klm..ngb..uwq..4b7..2w..x51..yne..4l..dm..5g2..sk..wqw..vta..d6..m1o..xe..r4..rhr..wz..pq..9u..gjm..rf..p8..fb..0m..96v..rm..ns..ib..dw..jx..3wy..ddb..06..qz..6jy..nu..uvn..ll..e5..fh..su..zc..imp..ikr..4z..ox..s2..5d..oe..rgc..gs..dy..nl..ejn..xz3..tbl..xo..i4q..kh9..k0..rs..c9..eck..gtr..rg..eu1..do..wjy..xw..nb..t4d..vv..de..qw..lkf..ht..gis..gb..bre..xw..8ik..y0..9bl..yt..ync..lz..dv4..32z..h9u..6a..4z..va..jr..53k..8h..rym..v0..ywk..s9..5ae..y0..sgw..upf..m2..veg..za..vmd..zh..ok1..di..uj..mlp..luf..dcq..dvl..9m..kwv..3a..vv..h2b..uii..nu..ha..hw9..fq..mzs..ir..2ov..wl..uor..llk..h9x..3ke..xt8..wbd..4t..r3v..r89..etb..cb..j4y..ne..7ky..9c..jl3..oh..dr..dth..gg..kv5..tf..su7..ola..mv..tno..fl..xv..6q..zx..ky..xxj..rpz..zwd..7j..oqi..3k..xx..gcw..4n..bh..i5w..aa..hit..nzh..eq..9rg..mor..s7e..sy..id..s3..5e..x1..rz5..xnv..9z..2z..nbk..xwr..bde..qcr..b3w..zj..k38..pm..j9..sic..wb..kh..byo..q1m..w9p..qi..ne..1qh..jei..pvz..xt..4o..me..lv..xsk..yp..3ew..s7..8g..g1..pom..rum..0b..1uv..qbz..k8..q7..w3w..kl..mja..iom..hy..u2..vf..5rs..yq..lr..alz..edd..uz..xfo..16..yv..0jk..po..b93..3t..dwt..rr..82..8p..gr..tq..l7m..m3..uw..bo..dn..ak3..gh..ei5..fea..bdx..w0..gz..d8w..hv..yxc..lcn..r3..tda..1p..gth..n4..jf..mp8..fp..cg..ej..3g..wk6..tz..a3o..f2..ev..gg..cd..a8v..v8..sc..5du..qly..hn..py..jjx..hq..iz..qga..rn..28..j2..tr..ne..8nz..tc..waq..tt5..zdo..8vz..yoi..it..0gs..gwf..0kh..gdm..xa..gb..eio..oy..k2..n2s..6t..jyc..l4h..8s..qol..fm..ywc..tc8..6j..krz..uk2..3bu..2u..w9k..xut..cg8..cx7..r8h..7yv..qlc..zz..fmb..cb..ze..tg..wfm..ze..kk..6w8..nm..z7m..u9..qr..to2..xt..qr..zbn..yb..dq..ovh..ux..bg..dk..pap..dy..5v5..ny..xo..lt..aya..luj..5b..0k9..jcv..e5..fs..6c..nv..oo..vb..ia..hrb..vsy..zgj..rsi..luq..gfv..lm..gp..db..iop..zuz..k51..tfj..rv..yi..23s..zfk..cdx..nwj..nnw..rg..38..zr..uhm..voi..bqn..jlx..bj..vo..cq..gh..41..5f..r4..dl..az..sw..y2..cy..gue..pv..4cg..yh..wl..klz..sd..xl2..2ug..jx9..jhg..qfk..o0..ya..q4c..wqv..fsc..tin..9s..td..gc..f8d..xiw..twh..afq..vl..h3..dk..xca..eh..hgy..tc1..re5..hfu..so..bvc..jy..0jb..rm..yg..yl..0qb..sp..3l..fiq..5mp..om..lq..tbk..69v..jx..ylq..zc..ha..dva..4w..nlc..jz6..sy..ip..ir..7iu..vdw..td..0zn..yww..oj..dh..q5d..d2..le..9kp..1s..xm..vz..34t..tlt..zc..axk..f7..mnp..rk2..sm..qf..3a..zy..sh..r1z..wca..h0..rl..uz..4s..uc..y0..up..od..cy..fe..tmz..lwe..os..rx..mm..ghb..lv4..un..unn..gr..ka..j6k..9k..sp..vu3..xxx..q4p..iq..s8..zc7..ju..eb..yv..y1p..0o..ka..cj..h6..m9..bwn..sqi..ah..bb..6k..lh..dk..iza..qpk..qjh..irt..ddp..zg..nx..cp..ghy..cmv..zr..fs..jc..sru..etm..0ld..mow..bb..kx..v1z..zy..1q..se..m6..9xz..lh..tn..rz..r5o..st5..owy..pq..rrt..nw..fzb..6v3..ez..vnp..8w..ha..oe..4zh..i3x..hpw..uz..3l..ddk..h8b..edd..l9w..xay..ds..osv..o3..sf9..lcg..27..t3..uo..zpo..d7b..ujt..pis..ze..sf..hz..ylj..jj..hx..t2i..cru..eus..2d..2w..uh..h1..ql..fj9..aq..0l..mi2..5s..mc..aq..hv..jd..gm..ay..fs..0ek..odn..hj..cv0..f2..1nx..4lk..81..sc..rir..zj..w29..9as..fiw..oj..qn..1dm..bp..cb..bdr..dkg..yvl..j9o..6b..qxs..rij..di..bk5..md..dw..ok..fp..rs..7wj..h1..46..xw..v8..ike..zb..qgz..2ys..8p..jnh..o8n..fo..qjq..nrn..bz..l5r..jmz..qg..di..2u..f1..k8e..0m0..rf..7qf..jur..w8..7ei..abf..gl..pw..jb..68..jc..m4p..fxw..pjv..ka..kzm..lj..4p..va..be..hzz..wjv..gi1..doj..zg..8i0..hv6..rmf..dky..zpr..e4..jt..ihw..fdf..vk..p0..iid..xt..d2..ggp..fdh..bl..ok..cjj..cq..os..vnq..cnn..xq..2q..int..q21..dft..glk..lj..yvn..jn..ah..ey..mdg..rq..lp..vxj..pug..rn..ho..9ua..7dz..l4..go..2zz..kq..bj..qw..3xv..wnv..cri..xcw..33i..rhm..v3..7c..urm..ks..mm..xtb..ujc..2xv..tt4..lpj..gh..7x..sc..tu..fd..kjx..xn8..tyt..91..tyn..hp..4iq..ts..wkm..xx..kuz..fz..9vi..0vn..lvb..5ft..bst..eh..ei..md0..4er..kk..18l..xm..gm..i7..zn1..57l..ka..so8..th..nh..yu..rfh..aj..cw..dy..jxd..3ei..0j..0r..ie..tvk..co..0rv..jdu..rn..4en..z5w..5lf..1b..wgm..31n..lb6..gj..ucg..4i..q2..ee..gss..g6w..nc..s1j..lwo..xl..8ko..8f..ma..ek..wb..sdm..qy..ma..4sa..wea..cg..bt..iw..ps..tz5..v4d..62j..fv..7h..x7..rm..go3..xjy..y8..dnn..w7c..4s..vi..wi..cf..iur..mcu..ai..ogh..w1w..9zd..8i2..m5i..df6..bp..31..bl..s0..8px..nnh..aoz..iht..th..mox..p4..td..bxq..kg..uw..ns..n11..tl..9a..ku6..wze..2ab..eop..zn..yq..ep..xz..tzo..2m..uy..qx5..jpv..1yj..ol..gw..egf..5qb..gik..mqe..tj..6j..ah..o7z..9j..ui..ej..hp..5il..kz..v7y..pjt..zz..fd..vm..i6t..iw..6k..mc..al..u4g..adf..io..ff..k1d..pre..fdm..8w..gf..tx..2vj..v6g..l6..g5..wa..f9..gt..udt..lux..ft2..tgh..xh0..rh..dk..62..n1m..oev..f3..gv..ph..an..mnz..odc..wt..gg4..r9..nb..zw..8pn..lyv..rr..3n..re..tz..idi..r7..8bm..knu..ak..nb..u3n..v9..lq..es..exk..yil..hzc..ri..pnj..ap..gf..bpr..up..nv..vq..6n..0kr..fe..k11..dwr..9m..mk..os..tox..v9..bmq..2f..9tu..qss..bj3..khu..ag..zco..xo..ui..sjf..xaa..4gd..7h..cl..zh..lsg..8lv..fz..em..r0..fjo..bew..z6..ks..gf4..uxh..euq..ps..3r..om6..ee..ko..u4..ei..pm..2sx..w2g..5fq..rp..ls..ev9..qii..eza..fh..bb..qd..lgr..76d..vz..cz..sdd..6o4..mu..ubd..93a..ben..ipg..xpn..qvv..8n..qw..oa..aea..icz..0gu..ibd..fj0..ptl..el..8mu..rc..9ib..8wc..no0..mk..avv..xf..aj9..bdh..t6..uoi..3z..tm..be9..u71..7ru..nt..oo8..qsq..vw5..ntb..3c..5st..jm4..c5z..naj..dqa..hv..smz..g3j..k26..cv..ws6..xwp..eu..bhn..z7..nc..ov..kwx..g1..bjg..c3..tx..r9a..gxm..ve..r8j..xf..ui4..oza..bda..os3..y9b..ke..srb..mv..5h9..th..c7..ch1..kc..jt..7xn..6tg..qmc..rj1..5ad..qb..2x..xl..aa5..2s..ehs..id..ef..ict..bor..72g..dkk..6j..ek..gt..sum..xyb..ks..gv4..olk..bz..t8k..ntt..wl..2zq..nn..ec..2tr..co..a2i..xk..ca..hp..awr..qp..rhu..fqq..j1i..oh..hef..4s..no..lmy..us..42z..me..5mz..ws8..tdt..cr..4e..7pn..m8..zka..je..pk..r3m..dd..aty..j0h..nou..9w..fz..4r..xma..raa..clz..87..1b..ing..ie2..dg..v9k..iqn..f8..yks..ga..8on..vi..jae..ih..yf..ql..1 How to Record Video for Your Selenium Tests Using FFmpeg

How to Record Video for Your Selenium Tests Using FFmpeg

Video for Your Selenium Tests Using FFmpeg

Using screenshots for your Selenium tests when they fail is cool, but there are some limitations. For example, it’s hard to know exactly what happened before a failure occurred using a snapshot. In my case, the biggest issue is that our applications sometimes have random modal popups appear that cause the Selenium image to be just a black screen — at least that’s my theory.


The problem is that the image only shows the browser’s viewport, not the full desktop. Rather than a screenshot, I feel that having a video recording would better help me to debug what is actually happening.


BlankScreen

My solution is to have our CI system start the recording before our test run, then stop it after the entire test scenario is completed.


Since our test log files are time stamped, we can navigate to that time in the video recording to see what was going on. This method is kind of crude, since it will record nonstop, but it’s a good first step. 

To do this we choose FFmpeg. (You could, of course, bypass all this by simply using Sauce Labs, which has a much more advanced video recording option.)

FFmpeg is an open-source, command line video/encoding software utility that allows you to record video and audio of your desktop. The first issue I found with it is that it’s not very clear how to go about installing FFmpeg, and what commands you need to use to create a recording. So, I decided to document what I had to do to get it working on my machine and share it with you.

What you’ll need for recording Selenium test runs:

First, install FFmpeg

  • To install, navigate to http://ffmpeg.zeranoe.com/builds/
  • Select the static version that you need
  • Extract to a location on your hard drive. (I chose C:\ffmpeg)
  • Next, go to Start>Run and enter sysdm.cpl
  • Under the System Properties dialog, click on the Advanced tab
  • Next, click on the Environment Variables
  • Under the User Variables section, click on the . button
  • Under the New User Variable dialog, enter:
  •    Variable name: path
  •    Variable value: c:\ffmpeg\bin (or the path the where you unzipped ffmpeg to)
  • To verify that ffmpeg is installed, go to Start>Run>cmd
  • In the CMD window, type ffmpeg – version
  • You should see something like this:
  • Next, while you’re still at the command line, type the following to see what video devices, if any, you currently have installed:
 ffmpeg –list_devices true –f dshow –i dummy

BadDevices

Notice that when I do this I get the error message Could not enumerate video devices (or none found).

This means that my machine doesn’t currently have any DirectShow video devices installed. FFmpeg needs a video device to use in order to record.

Install Screen_Capture_Recorder


The screen capture tool I chose was screen_capture_recorder, because it’s a free, open-source “screen capture” device. If you got the same video device error I did, you can easily install a valid video device by following these steps:

     ffmpeg –list_devices true –f dshow –i dummy


You should now see a valid video device listed:

GoodDevices

Cool. Now it’s time to record!

Command to record a screen capture using ffmeg

  • Navigate back to a command line window and to the ffmpeg\bin directory and enter the following:
 ffmpeg -f dshow -i video="screen-capture-recorder" -r 30 -vcodec mpeg4 -vtag xvid -qscale:v 0 bddrun.mkv
  • Press Q to stop recording

How to view the recording?


Notice how ffmpeg saves the recording as a .mkv file. In order to view it, you’ll need to first convert to an mp4 file.

  • Open a command line window
  • Navigate to the location of your .mkv file. Mine is under C:\ffmpeg\bin
  • Enter the following:
     ffmpeg –I name_of_yourFile.mkv –codec copy bddTestRun.mp4
  • Navigate to the directory where you converted your file. You should now see a .mp4 version of your recording:
  • Double click to play it back

Tips

Make sure your cmd.exe screen buffer size has a wide enough width.

cmd

Make a recording batch file


Instead of always having to type this command, whenever you want to record, you can create a batch file that contains the ffmpeg record command by following these steps:

  • Open up Notepad
  • Enter the following:
	@ECHO OFF
        ffmpeg -f dshow -i video="screen-capture-recorder" -r 30 -threads 0 bddrun.mkv
  • Save as record.bat
11comments
Tej - September 30, 2015

Hi Joe,

We do recording using MonteMedia Library,, Is there any advantage of doing this with FFmpeg? or is this just an alternative

Regards
Tej

Reply
    Joe Colantonio - September 30, 2015

    It depends on your needs. I would say this is an alternative but on the MonteMedia library site it says that its an experimental library for my personal studies! Because of this I choose FFmpeg become it seemed like a more mature solution. But go with what works for you :)

    Reply
Conrad Braam - October 2, 2015

Damn, beaten to it. I always suspected this was easy to do using ffmpeg. Thanks for the legwork all done for us here Joe!

Reply
    Joe Colantonio - October 7, 2015

    Thanks Conrad!

    Reply
Automate the Planet - October 4, 2015

[…] with Neo4j using C# – Andreas Kollegger Advanced Locator Strategies – Isaac Murchie How to Record Video for Your Selenium Tests Using FFmpeg – Joe Colantonio The True ROI of Test Automation – (Abstracta) How Software […]

Reply
Mohan - November 26, 2015

Hi Joe,

Will this “ffmpeg” work on Linux environment? We are running headless selenium automation scripts hosted on jenkins in Linux OS but I am not sure how to record the execution with “ffmpeg” + “screen_capture_recorder” !

Reply
Narendra - April 21, 2017

Does this capture the operations performed on headless browser like phantomjs?

Reply
    Joe Colantonio - April 21, 2017

    Not sure – it’s a headless browser so what would there be to see?

    Reply
John Stewart - August 10, 2018

Is there a thread safe method that will work on Selenium Grid? All the solutions I have looked at for C# Selenium don’t work on Grid.

Reply
Click here to add a comment

Leave a comment: