0

次のコマンド

selenium.click("link=Identify Awards");

ポップアップを開きますが、テストは続行されません

私は配置しました

selenium.waitForPopUp(null, "1500");
selenium.windowFocus();
selenium.selectPopUp("Search -- Webpage Dialog");

役に立たないクリックコマンドの後、リンクはJava関数に移動します。

このコマンドがリンク、ボタン、チェックボックス、またはラジオボタンをクリックすることを知っています。クリックアクションによって新しいページが読み込まれる場合(リンクが通常行うように)、を呼び出します waitForPageToLoadwaitforPageToLoadポップアップの読み込みが登録されていないと思います

アップデート

私は以下を試しました

selenium.fireEvent("link=Identify Awards", "onClick");

そして、次のものを手に入れました

ポップアップが別のドメインにありますこれが原因である可能性がありますか?

Exception in thread "Main Thread" org.openqa.selenium.ie.UnexpectedJavascriptExecutionException: Cannot execute script
System info: os.name: 'Windows Vista', os.arch: 'x86', os.version: '6.1', java.version: '1.5.0_12'
Driver info: driver.version: ie
    at org.openqa.selenium.ie.ErrorHandler.verifyErrorCode(ErrorHandler.java:70)
    at org.openqa.selenium.ie.InternetExplorerDriver.executeScript(InternetExplorerDriver.java:205)
    at org.openqa.selenium.internal.seleniumemulation.JavascriptLibrary.callEmbeddedSelenium(JavascriptLibrary.java:47)
    at org.openqa.selenium.internal.seleniumemulation.FireEvent.handleSeleneseCommand(FireEvent.java:35)
    at org.openqa.selenium.internal.seleniumemulation.FireEvent.handleSeleneseCommand(FireEvent.java:1)
    at org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:33)
    at org.openqa.selenium.internal.seleniumemulation.Timer.run(Timer.java:47)
    at org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:277)
    at org.openqa.selenium.WebDriverCommandProcessor.doCommand(WebDriverCommandProcessor.java:209)
    at com.thoughtworks.selenium.DefaultSelenium.fireEvent(DefaultSelenium.java:201)
4

2 に答える 2

1

特にseleniumのクリック関数でjavascriptをトリガーすると、要素のonClickコマンドが正しく呼び出されない場合があり、これが問題になる可能性があることがわかりました。

その場合は、以下を使用してonClickイベントを明示的に発生させてみてください。

selenium.fire_event("link=Identify Awards", "onClick")

お役に立てば幸いです。

于 2010-11-22T10:18:08.283 に答える
1

を使用selenium.selectWindowしてポップアップを選択してから、を使用selenium.selectWindow(null)してベースウィンドウを選択します。あなたはそれがどの種類のポップアップであるかを説明しませんでした。確認ボックス、フレーム、モデルダイアログ、または単に別のウィンドウです。セレンはこれらすべての治療法が異なります

于 2012-01-31T10:27:48.837 に答える