Java 对话框中“确定”按钮上的“未找到对象”错误

Java 对话框中“确定”按钮上的“未找到对象”错误,java,testing,rft,Java,Testing,Rft,在我的应用程序中,通过单击“保存”按钮,对话框会提示一条带有“确定”按钮的消息。录制时,“确定按钮”被录制并显示“文本\确定。单击点11,8;”。但在回放过程中,它显示了一个“未找到对象”错误。 最近更新了RFT版本8.2.2.1,在此之后,只看到此问题。 谁能告诉我如何解决这个问题,或者如何用java编写代码 我的回归正在等待,由于这一点,你的帮助是非常值得赞赏的。 提前感谢。通过Selenium Web驱动程序API,我建议您执行以下操作: Alert alert = driver.swit

在我的应用程序中,通过单击“保存”按钮,对话框会提示一条带有“确定”按钮的消息。录制时,“确定按钮”被录制并显示“文本\确定。单击点11,8;”。但在回放过程中,它显示了一个“未找到对象”错误。 最近更新了RFT版本8.2.2.1,在此之后,只看到此问题。 谁能告诉我如何解决这个问题,或者如何用java编写代码

我的回归正在等待,由于这一点,你的帮助是非常值得赞赏的。
提前感谢。

通过Selenium Web驱动程序API,我建议您执行以下操作:

Alert alert = driver.switchTo().alert(); 
   alert.accept();

希望这对您有用

您没有提到它是什么类型的对话框窗口。但是您可以尝试RFT的iWindows API来查找活动的顶部窗口,并按照下面指定的方式执行单击。 下面的eg代码可以通过调用

  handleDialogButton("Message from Webpage", "ok");   
      handleDialogButton("font","cancel"); 
或者,通过调用来单击记事本字体对话框“格式”>“字体”上的canel按钮

  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();
}

投票被否决,因为问题是关于RationalFunctionalTester的,而不是SeleniumIts的网页对话框问题。这是Aspx