イメージをクリックすると生成されるjQueryモーダルウィンドウに切り替えたいと思います。しかし、Selenium(IE Webdriver)は生成されたモーダルウィンドウを認識できず、切り替えもできません。例外/エラーは表示されません!Selenium IE Webdriver:jQueryモーダルウィンドウに切り替えることができません
IE版 - 11 セレンバージョン - 2.53 IE webdriverをバージョン - 2.53.1
Iはスイッチング用試みたコード:
objMovePage.clickFromAccountPicker(); //Image clicked
Thread.sleep(2000); //Wait for new window to show up
Set<String> windows = driver.getWindowHandles();
System.out.println(windows.size()); // This returns 1 always.
for(String handle: windows)
{
driver.switchTo().window(handle);
}
System.out.println(driver.getTitle()); //Prints current window title
Iもdriver.switchTo().window("<window name>"); // This also doesn't work.
を試みました画像をクリックするとHTMLコードが表示されます
<td style="height: 20px">
<input id="imgPickAcct" align="top" type="image" style="border-width:0px;" onclick="PickAcctClick(711269, 450, 300);" src="images/magnifyglass.gif" tabindex="-1" name="imgPickAcct">
</td>
JS機能コード
function PickAcctClick(intTransmissionID, intwidth, intheight)
{
var lstrPath = 'wfrmGetTransmittedAccounts.aspx?TransmissionID=' + intTransmissionID;
var returnValues = openModal(lstrPath, intwidth, intheight);
if (returnValues != undefined)
{
document.forms[0].txtFromAccountingID.value = returnValues[0].toString();
document.forms[0].txtFromDept.value = returnValues[1].toString();
document.forms[0].txtFromAcct.value = returnValues[2].toString();
document.forms[0].txtFromCur.value = returnValues[3].toString();
document.forms[0].txtFromProduct.value = returnValues[4].toString();
if (isAnObject("txtFromChart1"))
{document.forms[0].txtFromChart1.value = returnValues[5].toString();}
if (isAnObject("txtFromChart2"))
{document.forms[0].txtFromChart2.value = returnValues[6].toString();}
if (isAnObject("txtFromChart3"))
{document.forms[0].txtFromChart3.value = returnValues[7].toString();}
}
return false;
}
注:これはshowModalDialogからのアラートまたはダイアログウィンドウではありません。 編集:iFrameはありません。
新しいウィンドウで開き、独自のHTMLコードを使用します。私は要素の操作を実行しようとしましたが、NoSuchElementExceptionを取得しようとしました。 – Haxor
本当のポップアップですか?私はあなたが 'System.out.println(windows.size())を書いて以来、それが疑わしいです。 //これは常に1を返します。これは、新しいウィンドウが作成されていないことを強く示します。また、モーダルウィンドウは新しいウィンドウで開くはずです。モーダルウィンドウがポップアップであり、セレンで見つからないことがわかっている場合はスクリーンショットまたはhtmlを投稿してください – samjaf
スクリーンショットが追加されました。 – Haxor