ここでは、最小限の Selenium RC スタイルのテストを実行しようとして、完全に途方に暮れています。私が経験している問題は、ウェブ上の多くのユーザーによって説明されていますが、私の場合、さまざまな解決策のいずれも問題を解決しませんでした。何が起こるかというと、Firefox が開きますが、「Firefox へようこそ!」というメッセージが表示されるため、空のプロファイルのように見えます。ページ。それとは別に、ブラウザでは何も起こらず、Seleniumサーバーログで次のことがわかります:
DEBUG [12] org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory - Requested browser string '*firefox c:\progra~2\mozill~1\firefox.exe' matches *firefox
DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Checking whether Firefox 3 launcher at :'c:\progra~2\mozill~1\firefox.exe' is valid...
DEBUG [12] org.openqa.selenium.browserlaunchers.locators.BrowserLocator - Discovered valid Firefox 3 launcher : 'c:\progra~2\mozill~1\firefox.exe'
INFO [12] org.openqa.selenium.server.BrowserSessionFactory - Allocated session 962d2221ccb4459b9adbad1b8734850c for http://www.google.com, launching...
DEBUG [12] org.openqa.selenium.server.browserlaunchers.ResourceExtractor - Extracting /customProfileDirCUSTFFCHROME to C:\Users\zb\AppData\Local\Temp\customProfileDir962d2221ccb4459b9adbad1b8734850c
INFO [12] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Preparing Firefox profile...
INFO [12] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Launching Firefox...
DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1800 more secs
DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms
DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - got condition? : false
最後の 3 行は、Selenium サーバーを再度停止するまで毎秒繰り返されます。
これは私のテストコードです:
import com.thoughtworks.selenium.DefaultSelenium;
public class Runner {
public static void main(String[] args) {
DefaultSelenium selenium = new DefaultSelenium("localhost", 4444,
"*firefox c:\\progra~2\\mozill~1\\firefox.exe",
"http://www.google.com");
selenium.start();
selenium.open("/");
selenium.type("q", "test");
selenium.click("btnK");
selenium.stop();
}
}
私は試した:
- Firefox の異なるバージョン (22、21、20)
- 異なるバージョンの Selenium サーバー (2.33.0、2.25.0、2.15.0、CI ビルド)
- Selenium クライアント ドライバーの異なるバージョン
- 異なるバージョンの Oracle JDK (1.6u24、1.6u45、32 ビット バージョンと 64 ビット バージョンの両方)
- テスト コード内のさまざまな Firefox ブラウザー ランチャー
- テスト コードでブラウザ パスを指定するかどうか
- Selenium サーバーを管理者として実行しているかどうか
- さまざまな Selenium サーバー オプション (カスタム プロファイルの有無、マルチウィンドウ モードなど)
- Firefox とカスタム プロファイルの異なる場所 (つまり、スペースの有無にかかわらずパス)
- Perl で書かれた上記の Java のような類似のテスト
それはすべて役に立たず、上で説明したように終わります。私はWindows 7マシン(64ビット)を使用しています。ちなみに、私が試した小さな WebDriver テストは期待どおりに動作します。
編集:サーバーが実際に「ハング」しないため、質問の名前を変更しました。期待どおりに機能しません。