6

centOS vm でヘッドレスで実行されている Jenkins があり、別のコンピューターで http 呼び出しを介してアクセスします。

UI Selenium テストを実行するためのプロジェクトがありますが、Firefox 以外はすべて正常に動作します。プロファイルが centOS vm にないことについて不平を言っているため、テストのために Windows VM に転送できます。yumには17(ヘッドレスCentOS VM)しかないため、centOSで最新かつ最高のfirefoxを入手する方法を知っている人はいますか?また、その VM で現在の firefox プロファイルを scp したいだけの場合、CentOS OS に格納されている firefox プロファイルはどこにありますか? 私が考えていない他の解決策はありますか?詳細が必要な場合はお知らせください。以下のジェンキンスエラー:

org.openqa.selenium.firefox.UnableToCreateProfileException: Given model profile directory does not exist: C:\Users\Selenium\FirefoxDriver Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-358.6.1.el6.x86_64', java.version: '1.7.0' Driver info: driver.version: unknown org.openqa.selenium.firefox.FirefoxProfile.verifyModel(FirefoxProfile.java:154) org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:92) org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:79) com.igt.sqes.automation.selenium.factories.WebDriverFactory.createWebDriver(Unknown Source) com.igt.sqes.automation.arcus.setup.ArcusTestSuiteSetup.setUp(Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:601) org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564) org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) org.testng.SuiteRunner.privateRun(SuiteRunner.java:277) org.testng.SuiteRunner.run(SuiteRunner.java:240) org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) org.testng.TestNG.runSuitesSequentially(TestNG.java:1198) org.testng.TestNG.runSuitesSequentially(TestNG.java:1194) org.testng.TestNG.runSuitesLocally(TestNG.java:1123) org.testng.TestNG.run(TestNG.java:1031) org.testng.TestNG.privateMain(TestNG.java:1338) org.testng.TestNG.main(TestNG.java:1307)

Windowsボックスから実行すると正常に動作するため、ドライバーはその場所にあり、テストvmに転送できます。

4

2 に答える 2

0

Selnium ノードを実行している Windows VM で使用するために CentOS VM で Firefox プロファイルを使用できるようにする 1 つの方法は、Windows で Firefox プロファイルを指す共有を作成し、その共有を CentOS にマウントすることです。これを機能させるために使用した手順は次のとおりです。

  1. Windows では、Firefox プロファイルがあるディレクトリの共有を作成します。デフォルトの Firefox プロファイルは通常、C:\Users\username\AppData\Local\Mozilla\Firefox\Profiles\427nha20.default のような場所にあります。読み取り専用権限を持つディレクトリなど、権限が制限されたディレクトリにプロファイルを配置することをお勧めします。
  2. CentOS では、Windows 共有に付けた名前で /mnt ディレクトリにディレクトリを作成します。名前は同じである必要はありませんが、一貫性を保つのに役立ちます。
  3. CentOS では、次の行を /etc/fstab ファイルに追加します。 //windowsVMIP/windowsShareName /mnt/windowsShareName cifs username=windowsUser,password=windowsPassword,uid=123,gid=123,_netdev,ro 0 0
  4. windowsVMIP は、共有を持つ VM の IP です。windowsShareName は Windows 共有の名前です。/mnt/windowsShareName は、Windows 共有に付けた名前です。username と password は、Windows ユーザーの資格情報です。uid は CentOS のユーザー ID です。gid は CentOS のプライマリ グループ ID です (grep jenkins /etc/passwd を実行すると uid と gid を取得できます。これらはそれぞれ 3 番目と 4 番目の属性です)。
  5. CentOS では、次のコマンドを実行して Windows 共有を手動でマウントします。
  6. /mnt/windowsShare に cd して ls を実行し、マウントが成功したことを確認します
  7. CentOS マウント共有を指すように FirefoxDriver.PROFILE 機能を設定して、Selenium Firefox ドライバーを構成します。次に、作成時に機能を Selenium Webdriver に渡します。たとえば、Java では次のようになります。

    FirefoxProfile profile = new FirefoxProfile(new File("/mnt/windowsShareName")); DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(FirefoxDriver.PROFILE, profile);
    WebDriver driver = new RemoteWebDriver(new URL(gridHubURL), capabilities);

  8. Firefox プロファイルは CentOS 共有から取得され、Selenium ドライバーがインスタンス化された後に Windows VM Selenium ノードに転送されます。

于 2013-09-12T21:12:38.973 に答える