首页 > 其他 > 详细

设置等待操作

时间:2016-06-18 12:49:03      阅读:136      评论:0      收藏:0      [点我收藏+]
package Page;

import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class element {
    private static WebElement element = null;
// 等待判断
    public static boolean isExistWebElement(WebDriver driver, String xpath) {

        // WebDriverWait wait = new WebDriverWait(driver, 2);
        try {
            WebDriverWait wait = new WebDriverWait(driver, 2);
            wait.until(ExpectedConditions.presenceOfElementLocated(By
                    .xpath(xpath)));
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}

 

设置等待操作

原文:http://www.cnblogs.com/cmm2016/p/5595890.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!