-
Notifications
You must be signed in to change notification settings - Fork 61
Media Commands
hekra01 edited this page Oct 4, 2015
·
1 revision
QtWebDriver support controlling media elements
Media elements can be controlled from the client side using the org.openqa.selenium.qtwebkit.Player API
E.g:
import org.openqa.selenium.qtwebkit.Player;
import org.openqa.selenium.qtwebkit.Player.PlayerState;
import org.openqa.selenium.qtwebkit.QtWebKitDriver;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.remote.QtWebkitAugmenter;
import org.openqa.selenium.remote.RemoteWebElement;
public class Test {
public void test() {
RemoteWebElement findElement = (RemoteWebElement) driver.findElement(By.xpath(video_elemnt_xpath));
Augmenter a = new QtWebkitAugmenter();
WebElement augment = a.augment(findElement);
Player p = (Player) augment;
PlayerState state = p.getState();
if (state != PlayerState.playing) {
p.play();
}
else
p.pause();
}
}The following commands have been added:
| /session/:sessionId/element/:id/-cisco-player-element/state |
|---|
| GET /session/:sessionId/element/:id/-cisco-player-element/state |
Returns the current state of the media player
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
Returns:
String-The player state.
* Stopped = 0
* Playing = 1
* Paused = 2
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| POST /session/:sessionId/element/:id/-cisco-player-element/state |
Changes the state of the player
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
JSON Parameters:
:state - the new state of the player..
* Stopped = 0
* Playing = 1
* Paused = 2
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| /session/:sessionId/element/:id/-cisco-player-element/volume |
|---|
| GET /session/:sessionId/element/:id/-cisco-player-element/volume |
Returns the current volume level of the media player
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
Returns:
String-The player volume as a floating point value between 0 an 1
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| POST /session/:sessionId/element/:id/-cisco-player-element/volume |
Changes the volume of the player
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
JSON Parameters:
:volume - the new volume of the player as a floating point value between 0 an 1
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| /session/:sessionId/element/:id/-cisco-player-element/seek |
|---|
| GET /session/:sessionId/element/:id/-cisco-player-element/seek |
Returns the current position of the player
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
Returns:
String-The player current position in seconds
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| POST /session/:sessionId/element/:id/-cisco-player-element/seek |
Changes the current position of the player
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
JSON Parameters:
:position- the new position of the player as a floating point value in seconds
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| /session/:sessionId/element/:id/-cisco-player-element/mute |
|---|
| GET /session/:sessionId/element/:id/-cisco-player-element/mute |
Returns the current mute status of the player
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
Returns:
boolean-true if the playe ris muted
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| POST /session/:sessionId/element/:id/-cisco-player-element/mute |
Changes the mute status of the player
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
JSON Parameters:
mute- the new mute status of the player as a boolean
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| /session/:sessionId/element/:id/-cisco-player-element/speed |
|---|
| GET /session/:sessionId/element/:id/-cisco-player-element/speed |
Returns the speed of the player as a floating point value
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
Returns:
String-The player current speed
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| POST /session/:sessionId/element/:id/-cisco-player-element/speed |
Changes the speed of the player
URL Parameters:
:sessionId - ID of the session to route the command to.
:id - ID of the element to route the command to.
JSON Parameters:
speed- the new speed of the player as a floating point value*
Potential Errors:
NoSuchWindow - If the currently selected window has been closed.
StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
| Content Type | Qt4.8.5 | Qt5.2.0 |
|---|---|---|
| HTML | Video tag | Video tag |
| Widget | N/A | QVideoWidget & QMediaPlayer |
| QML | N/A | Video Element |
Home | Build And Run | Releases | Features
Copyright © 1992-2016 Cisco and/or its affiliates