简体   繁体   中英

check whether model dialog box is present or not in selenium using java

Is there anyway to check whether an model dialog box is present in Selenium web driver? I am using the following code:

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

This code is working fine for checking whether alert dialog box is present or not. And I want to check whether model dialog box is present or not in selenium using java. Please help me out to fix this issue.

我相信这个问题的第二个答案就是您要寻找的答案: 如何使用WebDriver检查警报是否存在?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM