FirefoxBinaryが見つからない/開くことができない-webdriver/robotフレームワーク
私のテストはjavaとfitnesseで正常に実行されます。InternetExplorerとChromeを使用してロボットフレームワークを介して実行する場合も正常に動作します。ただし、「new FirefoxDriver()」を使用してFirefoxで実行すると、次のエラーが発生します。
DEBUG java.lang.ExceptionInInitializerError
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java: 81)
Caused by: java.lang.NullPointerException
org.openqa.selenium.firefox.FirefoxBinary.<clinit>(FirefoxBinary.java: 42)
... 183 more
FirefoxBinaryクラスとFirefoxDriverクラスでは、これらの行は次のコードに対応しています。
FirefoxBinary ln42-43
private static final String PATH_PREFIX = "/" +
FirefoxBinary.class.getPackage().getName().replace(".", "/") + "/";
and FirefoxDriver ln 80-82
public FirefoxDriver(FirefoxProfile profile) {
this(new FirefoxBinary(), profile);
}
クラスパス、pythonpath(robotframeworkで使用)およびpathでFirefoxバイナリへのパスを設定してみました。また、バイナリを強制的に検出するために、次のコード行を記述しました。
System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(FirefoxDriver.BINARY, "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
仕事用と自宅用の2台のコンピューターでテストを実行しようとしました。さらに、firefox.exe –pを使用して作成されたFirefoxプロファイルを使用し、Javaコードで作成しようとしました。Firefox6-8を試しました。残念ながら、これらのことはどれもうまくいきませんでした。
私も使用しています/使用したことがあります:Java 1.6 Selenium 2.9.0 / 2.13.0 Windows 7
これが関連しているかどうかはわかりませんが、回避策として、Firefoxをリモートブラウザで実行できるようにしようとしています。私は次のコードを試しています:
rcc = new RemoteControlConfiguration();
rcc.setPort(4447);
rcc.setPortDriversShouldContact(4447);
rcc.setInteractive(true);
rcc.setSingleWindow(true);
rcc.setTimeoutInSeconds(30);
ss = new SeleniumServer(rcc);
ss.start();
DesiredCapabilities cap = new DesiredCapabilities();
cap.setJavascriptEnabled(true);
cap.setBrowserName("firefox");
URL url = new URL ("http://www.google.com/");
driver = new RemoteWebDriver(url,cap);
ただし、上記を実行すると、次のエラーメッセージが表示されます。
Exception in thread "main" org.openqa.selenium.WebDriverException: Error communicating with the remote browser. It may have died.
Build info: version: '2.13.0', revision: '14794', time: '2011-11-18 17:49:47'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0'
Driver info: driver.version: Selenium2Driver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:412)
誰かが私の問題のいずれかを修正する方法について何か考えがありますか?
どんな助けでも大歓迎です、私はこの問題atmで非常に立ち往生していると感じます。Internet Explorerがすでに機能しているときにFirefoxを機能させようとする2日間…..まるで、世界が終わりに近づいているように感じます。
ありがとう、ジェームズ
編集:1
selenium-serverを使用してFirefoxを実行することは可能です。