Is there any way to capture video while Selenium tests running (Webdriver, java,)

3,583 views
Skip to first unread message

Nischand

unread,
Apr 11, 2012, 3:03:31 PM4/11/12
to seleniu...@googlegroups.com
Hi users,

i am wondering that is there any chance to record entire test while it runs, have goggled found some  Monte Media Library ScreenRecorder.jar  and pyvnc2swf and had created Castro. but not working,, ???

or any plugin for Eclipse?

David

unread,
Apr 11, 2012, 7:40:34 PM4/11/12
to Selenium Users
I don't recall WebDriver natively having built in video capture of
test execution, only screenshots when test fails. If you want this
you'll have to rely on third party tools integrated with WebDriver.

If you want built in support, consider checking out SauceLabs.com.
They're service includes video screen capture of the whole test
execution and they support Selenium 2 / WebDriver as well. They have
free account version but its limited.

For 3rd party tools, I believe vnc2swf or vnc2flv are good options. Do
note that you don't necessarily have to have these tools running in
"Java"., though it is better toThey could be compiled binary
executables (in the case of vnc2swf and vnc2flv) and you just launch
those at the beginning of test (test setup) and stop them at end of
test (teardown). But if the tools don't have command line or API
interface or config file to auto config/start recording, you might
need to add in GUI automation to start/stop the recording or kill the
process.

The vnc2swf tool has precompiled installer version for Windows:
http://davidf.sjsoft.com/files/pyvnc2swf/pyvnc2swf-0.8.2.1-setup.exe

On Apr 11, 12:03 pm, Nischand <mails2chandr...@gmail.com> wrote:
> Hi users,
>
> i am wondering that is there any chance to record entire test while it
> runs, have goggled found some  *Monte Media Library **ScreenRecorder.jar
> and * pyvnc2swf and had created Castro. *but not working,, ???
>
> or any plugin for Eclipse?
> *

vamsi chandra

unread,
Apr 12, 2012, 8:15:27 AM4/12/12
to seleniu...@googlegroups.com
Hi David,
 
how can i use this in my tests? like how to start and stop ?
and embadded in my project! can u please explain? u said binary
executables what does that mean is there any link to know more info...
iam using (selenium webdriver java junit) win7
 
 
 
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


vamsi chandra

unread,
Apr 12, 2012, 8:19:03 AM4/12/12
to seleniu...@googlegroups.com
Hi David,
iam trying this with Screenrecorder.jar file
but cant creare screenRecorder object...  Thanks for reply ...
 

import org.openqa.selenium.By;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.firefox.FirefoxDriver;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 import org.openqa.selenium.support.ui.WebDriverWait;
 //import ch.randelshofer.screenrecorder.ScreenRecorder;
 import java.awt.*;
 import org.openqa.selenium.*;
    import org.monte.*;
    import org.monte.media.beans.*;
    import org.monte.screenrecorder.*;
   
   
 public class SeScreenCastDemo {
  public static void main(String[] args) throws Exception {
  // Create a instance of GraphicsConfiguration to get the Graphics configuration
   // of the Screen. This is needed for ScreenRecorder class.
   GraphicsConfiguration gc = GraphicsEnvironment//
   .getLocalGraphicsEnvironment()//
   .getDefaultScreenDevice()//
   .getDefaultConfiguration();
   
   
   screenRecorder sc = new screenRecorder();
  
  // Create a instance of ScreenRecorder with the required configurations
   screenRecorder = new ScreenRecorder(gc,
   new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, "video/avi"),
   new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
   CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
   DepthKey, (int)24, FrameRateKey, Rational.valueOf(15),
   QualityKey, 1.0f,
   KeyFrameIntervalKey, (int) (15 * 60)),
   new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey,"black",
   FrameRateKey, Rational.valueOf(30)),
   null);
  // Create a new instance of the Firefox driver
   WebDriver driver = new FirefoxDriver();
  // Call the start method of ScreenRecorder to begin recording
 //  screenRecorder.start();
  // And now use this to visit Google
   driver.get("http://www.google.com");
  // Alternatively the same thing can be done like this
   // driver.navigate().to("http://www.google.com");
  // Find the text input element by its name
   WebElement element = driver.findElement(By.name("q"));
  // Enter something to search for
   element.sendKeys("Cheese!");
  // Now submit the form. WebDriver will find the form for us from the element
   element.submit();
  // Check the title of the page
   System.out.println("Page title is: " + driver.getTitle());
  // Google's search is rendered dynamically with JavaScript.
   // Wait for the page to load, timeout after 10 seconds
   (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
   public Boolean apply(WebDriver d) {
   return d.getTitle().toLowerCase().startsWith("cheese!");
   }});
  // Should see: "cheese! - Google Search"
   System.out.println("Page title is: " + driver.getTitle());
  //Close the browser
   driver.quit();
  // Call the stop method of ScreenRecorder to end the recording
 //  screenRecorder.stop();

Pradeepta Swain

unread,
Apr 13, 2012, 1:57:53 AM4/13/12
to seleniu...@googlegroups.com
HI Nischand,

you won't be able to create any object of ScreenRecorder since it's an Abstract Class. Instead you can implement ScreenRecorderListener interface as shown below. You don't have to write the definitions for implemented methods. Just override them and leave the method body blank. Use the screen_player jar file to run the generated .cap file.

private ScreenRecorder recorder;

   @Test
    public void myRecordingMethod() throws Exception
    {
        try
        {
            FileOutputStream oStream = new FileOutputStream("Test.cap");
            recorder = new DesktopScreenRecorder(oStream, this);
            recorder.startRecording();
        } catch (Exception e)
        {
            e.printStackTrace();
        }

        WebDriver driver = new InternetExplorerDriver();

        driver.get("http://www.google.com");

        WebElement element = driver.findElement(By.name("q"));

        element.sendKeys("Cheese!");

        element.submit();

        System.out.println("Page title is: " + driver.getTitle());

        (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>()
        {
            public Boolean apply(WebDriver d)
            {
                return d.getTitle().toLowerCase().startsWith("cheese!");
            }
        });

        System.out.println("Page title is: " + driver.getTitle());

        driver.quit();
        recorder.stopRecording();
    }
    
    @Override
    public void frameRecorded(boolean arg0) throws IOException
    {
        // TODO Auto-generated method stub

    }

    @Override
    public void recordingStopped()
    {
        // TODO Auto-generated method stub

    }

Thanks,
Pradeepta
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Testmann

unread,
Apr 13, 2012, 8:47:07 AM4/13/12
to Selenium Users
Hi Pradeepta,

Thanks for throwing some light. However I'm not clear from where you
got the DesktopScreenRecorder class in Monte?

Best,
Unmesh
> >>>  To post to this group, send email to seleniu...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> selenium-user...@googlegroups.com.

David Santiago

unread,
Jun 20, 2013, 3:54:29 AM6/20/13
to seleniu...@googlegroups.com
I use the Monte library as part of the setup explained here http://bit.ly/video-recordings-of-browser-tests

Vishnu Varma

unread,
Mar 7, 2016, 1:53:38 AM3/7/16
to Selenium Users
Hi,

Below link is very useful for video recorder. 

This recorder will do on OS level. There is no video recorder for driver level. :(
Reply all
Reply to author
Forward
0 new messages