チャンネルが正常に再生されているか再生に失敗したかをテストするために、Web アプリケーション http:\wherever.tv を再生する TV チャンネルを自動化する必要があります。チャンネル再生用のSelenium IDE スクリプトがあります。チャンネルの再生に失敗した場合、どのように対処すればよいですか。チャネルはjwplayer
JWPlayer のチャネル障害メッセージを表示するにはどうすればよいですか。
以下は、チャンネルを再生するためのコードです。
public class Untitled {
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://wherever.tv/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testUntitled() throws Exception {
driver.get(baseUrl + "/index2.jsf");
driver.findElement(By.linkText("SIGN IN")).click();
driver.findElement(By.id("login:txtUserName")).clear();
driver.findElement(By.id("login:txtUserName")).sendKeys("testm1");
driver.findElement(By.id("login:txtPassword")).clear();
driver.findElement(By.id("login:txtPassword")).sendKeys("111111");
driver.findElement(By.id("login:cmbSumbit")).click();
driver.findElement(By.xpath("(//img[@title='(On Air) Play - This channel will work on TV'])[7]")).click();
driver.findElement(By.xpath("(//img[@title='(On Air) Play - This channel will NOT work on TV'])[4]")).click();
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alert.getText();
} finally {
acceptNextAlert = true;
}
}
}