2017-06-30 8 views

答えて

0

あなたはセレンのフラッシュテストについて話していますか?私たちは先に進む前にセレンのためのフラッシュジャーをダウンロードする必要があります。下のコードはあなたにいくつかのアイデアを与えるかもしれません。

public class Testyoutube { 

public static void main(String[] args) throws InterruptedException { 

// Open firefox browser 
FirefoxDriver driver = new FirefoxDriver(); 

// Maximize browser 
driver.manage().window().maximize(); 

// FlashObjectWebDriver is seperate class which is available inside jar which we have //attached 
FlashObjectWebDriver flashApp = new FlashObjectWebDriver(driver, "movie_player"); 

// Pass the URL of video 
driver.get("https://www.youtube.com/watch?v=7igozQAdBMs"); 
Thread.sleep(2000); 

// let the video load 
while (Integer.parseInt(flashApp.callFlashObject("getPlayerState")) == 3) { 
Thread.sleep(1000); 
} 

// Play the video for 10 seconds 
Thread.sleep(10000); 

// pause video using pauseVideo method 
flashApp.callFlashObject("pauseVideo"); 

Thread.sleep(5000); 

// play video using playVideo method 
flashApp.callFlashObject("playVideo"); 
Thread.sleep(5000); 

// Seek to is method which will forword video to 140 second 
flashApp.callFlashObject("seekTo","140","true"); 

// Wait for 5 seconds 
Thread.sleep(5000); 

//mute video using playVideo method 
flashApp.callFlashObject("mute"); 

// Wait for 5 seconds 
Thread.sleep(5000); 

//set the volume of video using setVolume method 
flashApp.callFlashObject("setVolume","50"); 

// wait for 5 seconds 
Thread.sleep(5000); 

} 

注:私はこれをテストしていませんが、それは動作するはずです。 参考:http://learn-automation.com/flash-testing-with-selenium-webdriver/

希望します。ありがとう。

+0

助けてくれてありがとう。残念ながら、それは動作していないようです - flashappは決してビデオオブジェクトをつかむことはありません。私はフラッシュビデオはYouTubeのものではないと思われる。 – elizaburkey

0

クイックフィックス/回避策として、Flash testing部分にKantuを使用できます。

関連する問題