2013-12-12 2 views
6

私は問題なくデフォルトプロファイルを使用します。しかし、私がカスタムプロファイルで始めると、Firefoxは起動しますが、 "ブロックされたまま"です。プロセスはアクティブなままで、31MBのRAMを消費しますが、起動することはありません。私がプロセスを抹殺してから始めると、セレンでうまく始まり、うまく動作します。Selenium 2 WebdriverでFirefoxを指定するにはどうすればいいですか?

私はWindows 7、Firefox 25.0.1、およびselenium-server-standalone-2.38.0.jarを使用しています。バージョンの互換性に問題があるかもしれませんか?

これは、プロファイルを開くためのコードです:

FirefoxProfile profile = new FirefoxProfile(new File("C:/Users/UserTest/AppData/Roaming/Mozilla/Firefox/Profiles/tydtn9km.testprofile"));     
WebDriver driver = new FirefoxDriver(profile); 

編集:私のために発生しました解決 問題: これは私の実際のコード

package org.openqa.selenium.example; 

import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.firefox.FirefoxDriver; 
import org.openqa.selenium.firefox.FirefoxProfile; 
import org.openqa.selenium.firefox.internal.ProfilesIni; 

public class Main { 
    public static void main(String[] args) { 
     ProfilesIni profile = new ProfilesIni(); 
     FirefoxProfile ffprofile = profile.getProfile("Other"); 
     WebDriver driver = new FirefoxDriver(ffprofile); 
     driver.get("http://google.com"); 
    } 
} 

編集2でありますFirefoxプロファイルは別のパーティションにあり、Firefoxは他のパーティションにあります。

答えて

5

私はこのようにそれを使用している:

まず、Firefoxのプロファイルを作成し、それが何らかの形であなたが知っている名前を付けます。例えば。 SELENIUM

は、その後、あなたのプロフィールを初期化:

ProfilesIni profile = new ProfilesIni(); 
FirefoxProfile ffprofile = profile.getProfile("SELENIUM"); 
WebDriver driver = new FirefoxDriver(ffprofile); 
+0

私はまさに。 +1 – sircapsalot

+0

これは私のコードより優れていますが、私の問題は解決していません。私はまだ同じ問題を抱えています。 Fedora 19でも、Fedoraでは最初に匿名プロファイルを開き、正しいプロファイルが正常に動作してから1秒後にオープンします。 – user3095228

+0

その場合、あなたのコードで(間違いがある)、Fedoraで何かが間違っていなければなりません(低い確率 –

関連する問題