C#

2016-05-04 1 views
-1

でセレンのwebdriverでHTML5ビデオを自動化しようとしています。ビデオは特定のIDを持っています、そのyoutubeから。私はjavascript excecutorを使って試しましたが、動作しません。リンクは次のとおりです: http://www.myhomepay.com/Tour/Nanny-Tax-GuideC#

答えて

0

こんにちはパルバシーは、以下のようにプレーヤーを再生してみてください。ここでキャッチするのはiframeの内部で実行されていないため、iframeを識別してそのiframeに移動してwebdriverでアクションを実行する必要がある理由です。

こんにちは私はJavaです男はそう

public static void main(String[] args) { 
     WebDriver driver = new FirefoxDriver(); 
     driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 
     driver.get("http://www.myhomepay.com/Tour/Nanny-Tax-Guide"); 
     driver.manage().window().maximize(); 

     // first identify the play button over the youtube video player 

     // Please note youtube palyer is inside the iframe hence first we have 
     // to identify and then switch to the i fame 

     List<WebElement> iframe = driver.findElements(By.tagName("iframe")); 
     System.out.println("Total iframe on the webpage is : "+ iframe.size()); 
     driver.switchTo().frame(iframe.get(0)); 
     driver.findElement(By.cssSelector(".ytp-large-play-button.ytp-button")).click(); 
    } 

はUPDATEがJavaで答えを投稿:C#のためにあなたが

iFrameElement = Driver.FindElementByTagName("iFrame"); 
driver = Driver.SwitchTo().Frame(this.iFrameElement); 
driver.FindElement(selector); 

は、C#の.hopeごとにコードをリファクタリングしてください下のようにそれを行うことができます。この

を支援