Automating the HTML5 video player
Up till now, there has not been a standard for showing a video on web pages. Most of the browsers depend on a plugin such as Flash to playback a video. However, different browsers have different plugins.
HTML5 defines a new element that specifies a standard way to embed a video or movie clips on a web page by 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, which 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:
@Test public void testHTML5VideoPlayer...