0

PopUp / new WindowJava で特定のものを処理しようとしましたが、うまくいきSeleniumServerません。終わったよ:

selenium.click("css=a[title=\"Some irrelevant title\"] > div.text");
Thread.sleep(5000);
    for (String s : selenium.getAllWindowNames()) {
    if (s.contains("_blank")) {
    selenium.selectWindow("name=" + s);
    selenium.windowMaximize();

    }
}

しかし、それは新しいウィンドウを認識しません。getAllWindowIDsまたは名前またはタイトルを使用すると、プライマリ ウィンドウの 1 つだけが返されます。

タイムアウト後に使用するselenium.waitForPopUp("foobar", "9999")と失敗するため、通常のを使用しThread.sleep()ます。

他に何ができますか?

4

2 に答える 2

0

最初に手動で行い、ポップアップが表示された後にボタンをクリックします Selenium ideを使用してそのポップアップに何かを記録するだけです..ウィンドウIDまたはタイトルを取得した場合は、「waitforpopup」コマンドでその「ID」を使用します。

于 2012-04-24T09:21:20.487 に答える
0

これは次のことに役立ちます。

selenium.RunScript("selenium.browserbot.findElement('css=a[title='Some irrelevant title']').target='my_window'");
selenium.RunScript("window.open('', 'my_window')");
selenium.click("css=a[title='Some irrelevant title']");
selenium.selectWindow("my_window");
selenium.waitForElementPresent("element_locator_at_popup")
于 2012-04-24T11:21:40.873 に答える