var captionsButtonCoordinates = null; function clickCCButton() { if (!captionsButtonCoordinates) { try { captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggle-closed-captions-button"); } catch (exception) { failTest(exception.description); return; } } eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordinates[1]); eventSender.mouseDown(); eventSender.mouseUp(); } function startTrackMenuTest(testFunction) { if (window.eventSender) { consoleWrite("
*** Set the user language preference."); run("internals.setUserPreferredLanguages(['en'])"); clickCCButton(); window.setTimeout(testFunction, 100); } } function getTrackListElement() { var trackListElement; try { trackListElement = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-closed-captions-container"); } catch (exception) { failTest(exception.description); return null; } return trackListElement; } function trackMenuList() { trackListElement = getTrackListElement(); if (!trackListElement){ failTest("Could not find the track list menu"); return; } // Track list should have a