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:
package com.secookbook.examples.chapter10; import java.io.File; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium...