2016-08-24 6 views
0

vjsプレーヤーに基づいてビデオを再生するテストをシミュレートしようとしていますので、Flashプラグインを無効にして機能させてください(デフォルトプレイヤーはjwplayerです)。以下は、まだ私のために動作しない(キーワードなど)私のコードの一部は、次のとおりです。ロボットフレームワークでテストを実行しているときにクロムのFlashプラグインを無効にする

*** Keywords *** 
Open Chrome Without Flash 
    [Arguments]   ${url} 
    ${options}=   Evaluate     sys.modules['selenium.webdriver'].ChromeOptions()  sys, selenium.webdriver 
    ${profile}=   Create Dictionary   plugins.plugins_disabled=Adobe Flash Player 
    Call Method   ${options} add_experimental_option prefs ${profile} 
    Create Webdriver Chrome     chrome_options=${options} 
    Go To    ${url} 

私の環境設定:

  • Google Chromeの52.0.2743.116
  • ロボットFramework 3.0の
  • Selenium2Library 1.7.4
  • Chromedriver 2.23.409687

おそらく誰もロボットフレームワークで動作させる方法を知っていますか?

答えて

0

ビットあなたのケースのためにテストされていないが、これは私がChromeでプラグインを無効にする方法に見つけたものです:

*** Test Cases *** 
Open Chrome 
    Set Options 
    Goto ${SOME_URL} 

*** Keywords *** 
Set Options 
    ${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver 
    ${disabled}= Create List Adobe Flash Player 
    ${preferences}= Create Dictionary plugins.plugins_disabled=${disabled} 
    Call Method ${options} add_experimental_option prefs ${preferences} 
    Create WebDriver Chrome chrome_options=${options} 

あなたはの名前を確認する必要がある場合がありますFlashプラグイン(上記コードのAdobe Flash Player)。

0

これは私がそれを(他のStackOverflow答えで示唆されるような醜い技術を使用して)無効にする方法です。

*** Settings *** 
Documentation  Test disabling Flash Plugin in Chrome 
Library   Selenium2Library 15.0 5.0 

*** Test Cases *** 
    Open Chrome And Disable Flash https://www.adobe.com/devnet/video/articles/fmp_player/_jcr_content/articlecontentAdobe/videomodal_0.content.html 

*** Keywords *** 
Open Chrome And Disable Flash 
    [Arguments] ${url} 
    Open Browser about://plugins Chrome 
    Wait Until Page Contains Plug-ins 
    ${myElement}= Get Web Element xpath=//div[2]/div[2]/div[2]/table/tbody/tr/td/div[1]/div[1]/span[.='Adobe Flash Player']/../../../div[contains(@class,'plugin-actions')]/span/a[contains(@class,'disable-group-link')] 
    Click Element ${myElement} 
    Go To ${url} 

私の環境設定:

  • のLinux - Fedoraの22を解放する(22個)x64bit
  • は、Python 2.7.10
  • Google Chromeの52.0.2743.116
  • ロボットFramework 3.0の
  • セレニウム2ライブラリ1.8.0b2
  • セレン2.53.6
  • Chromedriver 2.22.397932
+0

ええ、ちょっと醜いですが、私は通常、xpathの使用を避けます。読むのが少し難しいので、通常の戦略ロケータよりも少し時間がかかると言う人もいます。 結局おかげさまですが、私は別の答えを待つ –

関連する問題