Automating the HTML5 video player

HTML5 defines a new element that specifies a standard way to embed a video or movie clip on a web page using the <video> element. Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the <video> element.

In this recipe, we will explore how we can automate testing of the <video> element. This automated testing provides a JavaScript interface with various methods and properties for automation.

How to do it...

We will create a new test named testHTML5VideoPlayer for testing the <video> element. We will use the JavaScriptExecutor class from Selenium WebDriver to interact with the <video> element. We will control the video from our test code and also verify some properties of the video in the following way: ...

Get Selenium Testing Tools Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.