selenium处理div获取的弹框

时间:2015-06-08 11:29:49   收藏:0   阅读:675

目前遇到的弹框有两种,一种是alert,一种是div,如果遇到div模拟的弹框,在用alert就不行了。

1.

    public static Alert getAlert(WebDriver dr) {
        try{
            Alert alert = dr.switchTo().alert();
            return alert;
        }catch(NoAlertPresentException e) {
            System.out.println("alert not Exist");
            return null;
        }
    }

2.div

用findelement定位弹框

原文:http://www.cnblogs.com/qiaoyeye/p/4560285.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!