How to play & pause video using Selenium?

后端 未结 2 1581
北荒
北荒 2021-01-07 02:14

Can anyone help me with how to automate play/pause video present on the web page using Selenium..

Thanks in advance...

2条回答
  •  -上瘾入骨i
    2021-01-07 02:35

    By Using FlashObjectwebDriver !

    Now what is FlashObjectWebDriver ?

    FlashObjectWebDriver is an interface under Webdriver Library. FlashObjectWebDriver has a Method called : callFlashObject callFlashObject method can be over loaded using arguments ie. callFlashObject(“Play”) : For Playing the Flash callFlashObject(“Pause”) : For Pausing the Flash callFlashObject(“Previous”) : For playing previous Flash video callFlashObject(“next”) : For playing next Flash video callFlashObject(“SetVariable”, “/:Message) : For displaying the message . Implementation :

    FlashObjectWebDriver flashApp = new FlashObjectWebDriver(driver, "myFlashMovie");       
        // Pass the URL of video        
        driver.get("http://demo.guru99.com/flash-testing.html");            
        Thread.sleep(5000);     
        flashApp.callFlashObject("Play");           
        Thread.sleep(5000);     
        flashApp.callFlashObject("StopPlay");           
        Thread.sleep(5000);     
        flashApp.callFlashObject("SetVariable","/:message","Flash testing using selenium Webdriver");
        System.out.println(flashApp.callFlashObject("GetVariable","/:message"));
    

提交回复
热议问题