zoukankan      html  css  js  c++  java
  • [Selenium] WebDriver 操作 HTML5 中的 video

    测试播放,停止播放 http://www.videojs.com/

    示例:

    package com.learningselenium.html5;

    import static org.junit.Assert.*;

    import org.junit.*;

    import org.openqa.selenium.*;

    import org.openqa.selenium.firefox.FirefoxDriver;

    public class testHTML5VideoPlayer{

      WebDriver driver = new FirefoxDriver();

      @Before

      public void setUp() throws Exception{

        driver.get("http://www.videojs.com/");

      }

      @Test

      public void testHTML5Video() throws Exception{

        WebElement video = driver.findElement(By.id("home_fideo_html5_api"));

        JavascriptExecutor jse = (JavascriptExecutor )driver;

        String source = (String) jse.executeScript("return arguments[0].currentSrc;", video);

        //获取视频的播放源

        assertEquals("http://vjs.zencdn.net/v/oceans.webm", source);

        //播放

        jse.executeScript("return argument[0].play", video);

        Thread.sleep(5000);

        //暂停

        jse.executeScript("argument[0].pause()", video);

      }

      @After

      public void tearDown() throws Exception{

        driver.quit();

      }

    }

  • 相关阅读:
    springmvc的注解式开发
    springmvc
    spring整合Mybatis
    spring的事务管理
    注解定义增强的两个方法
    动态代理
    错题解析
    SpringMVC的基本操作
    Spring整合MyBatis
    配置事务以及事务回滚
  • 原文地址:https://www.cnblogs.com/feifeidxl/p/4554560.html
Copyright © 2011-2022 走看看