ダイアログウィンドウの種類については言及していません。ただし、RFT の IWindow API を試して、アクティブなトップ ウィンドウを見つけ、以下に指定されているようにクリックを実行することができます。
次の例のコードは、呼び出しによって html でアラート ダイアログ ボックスを処理できます。
handleDialogButton("Message from Webpage", "ok");
または、メモ帳の [フォント] ダイアログ ([書式] > [フォント]) で [キャンセル] ボタンをクリックするには、次のように呼び出します。
handleDialogButton("font","cancel");
-------サンプルコード----
/*
* Activates the top window with the given caption and clicks on the child control(window) with the specified text
* @param caption- Caption of the Dialog window
* @param btnToClick- Text of the button(any other control) to click
*/
void handleDialogButton(String caption,String btnToClick)
{
IWindow[] windows = getTopWindows();
for(IWindow window: windows)
{
if(window.getText().equalsIgnoreCase(caption))
{
window.activate();
//window.close(); //we can just close it also n break.
IWindow[] children = window.getChildren(); // OR go thru the children to get the child
for(IWindow child:children)
{
if(child.getText().equalsIgnoreCase(btnToClick))
{
child.click();
break;
}
}
}
}
unregisterAll();
}