Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openqa.selenium.firefox.FirefoxDriver;
- public class Youtube {
- public static void main(String[] args) throws InterruptedException {
- FirefoxDriver driver = new FirefoxDriver();
- FlashObjectWebDriver flashApp = new FlashObjectWebDriver(driver, "movie_player");
- driver.manage().window().maximize();
- driver.get("http://tinyurl.com/bqnaoo7");
- Thread.sleep(2000L);
- // let the video load
- while (Integer.parseInt(flashApp.callFlashObject("getPlayerState")) == 3){
- Thread.sleep(1000L);
- }
- // Play the video for 10 seconds
- Thread.sleep(5000);
- flashApp.callFlashObject("pauseVideo");
- Thread.sleep(5000);
- flashApp.callFlashObject("playVideo");
- Thread.sleep(5000);
- flashApp.callFlashObject("seekTo","140","true");
- Thread.sleep(5000);
- flashApp.callFlashObject("mute");
- Thread.sleep(5000);
- flashApp.callFlashObject("setVolume","50");
- Thread.sleep(5000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement