使用java检查selenium中是否存在模型对话框

使用java检查selenium中是否存在模型对话框,java,selenium-webdriver,Java,Selenium Webdriver,是否仍然需要检查Selenium web驱动程序中是否存在模型对话框?我正在使用以下代码: public boolean isAlertPresent() { try { driver.switchTo().alert(); robotClass(); System.out.println("Model dialog is present"); return true; } catch (NoAle

是否仍然需要检查Selenium web驱动程序中是否存在模型对话框?我正在使用以下代码:

public boolean isAlertPresent()
{
    try
    {
        driver.switchTo().alert();
        robotClass();
        System.out.println("Model dialog is present");
        return true;
    } 
    catch (NoAlertPresentException Ex)
    {
        System.out.println("Model dialog is not present");
        return false;
    } 
}

此代码用于检查警报对话框是否存在。我想用java检查selenium中是否存在模型对话框。请帮我解决这个问题。

我相信这个问题的第二个答案就是你要找的答案:

我相信这个问题的第二个答案就是你要找的答案:

编辑它,让它看起来更好或者我不熟悉堆栈溢出编辑它,让它看起来更好或者我不熟悉堆栈溢出问题是不需要等待警报和所有…我只想检查运行应用程序时是否存在任何模型对话框。。注意:我的问题是模型对话框不是警报。模型对话框不同,警报框也不同。我的问题是不需要等待警报和所有…我只想在运行应用程序时检查是否存在任何模型对话框。。注意:我的问题是模型对话框不是警报。模型对话框不同,警报框不同。