I have some videos and i want to test their with automation Can you tell How does selenium work with video? How does he recognize it. I need to test if are videos on the page. Thanks!

  • Do you need to validate that the video is there, or just that the container for the video is present? Commented Jun 2, 2011 at 15:04
  • I need to validate is video there.
    – ktarik
    Commented Jun 2, 2011 at 15:05
  • 4
    One of the hallmarks of a good question is that it shows individual research effort on the part of the asker. I think this is certainly a valid question, but it doesn't provide all that much to go one. Perhaps consider expanding it with more detail about the video you're trying to validate, and exactly what your objective is.
    – corsiKa
    Commented Jun 2, 2011 at 22:16
  • Thanks guys for answers. Now i have some updates. I use FlashSelenium but this <object> doesn't have id. Can you advise my smth?
    – ktarik
    Commented Jun 23, 2011 at 11:20
  • 1
    xpath? If you would like an answer, can you please provide a little bit more information. ie: glowcodeer's comment. Or, can your smith expand? Commented Jun 24, 2011 at 13:21

2 Answers 2


There are a few ways to do handle this...

For Flash Videos:

Most flash videos show up in iFrames, so you'll want switch to the iFrame container (using selectFrame) and then do an element test to verify the video content shows up correctly (using waitForElementPresent or verifyElementPresent).

As others have mentioned, if you're going to need to interact with the videos, you'll need FlashSelenium or flex-ui-selenium, but you can get much of the job done without them.

For HTML5 Videos:

For verifying they show up, an element test will work as mentioned above.

Also, since HTML5 videos often have CSS elements as controls, you can verify their functionality and playback by interacting with those elements. Here's an example script (note: page may change layout in the future):

open: http://html5video.org/
selectFrame: kaltura-video_ifp
click: css=span.ui-icon.ui-icon-play
verifyElementPresent: css=span.ui-icon.ui-icon-pause
waitForTextPresent: 0:05/1:41

That's how we set up our monitoring scripts in our Rigor accounts. Hope this helps!


If you need to validate that the video is there then it is a simple element check. BUT if you need to validate if the video is LOADED than that's a completly other thing.

Is the video a flash object? Then use http://www.adobe.com/devnet/flash/articles/flash_selenium.html flash selenium.

If it is a flex object use http://code.google.com/p/flex-ui-selenium/ flex selenium.

Hope that I could help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.