selenium2.4.0版本提供了页面等待处理。

显示等待元素可见:

 protected void WaitElementVisible(By by,int timeOutInSeconds,
long pollingInterval) {
WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);
wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
wait.withMessage(String.format("Timeout waiting for element: %s", locator));
wait.until(ExpectedConditions.visibilityOfElementLocated(by));
}

隐式等待:

 protected void Waitfor(By by,int timeOutInSeconds,
long pollingInterval) {
driver.manage().timeouts().implicitlyWait(timeOutInSeconds, TimeUnit.SECONDS);
}

WebDriver 页面等待的更多相关文章

  1. selenium1.0和selenium2.0页面等待处理详解

    一.selenium1.0页面等待 1.……AndWait 经常会看到, selenium action命令中很多有这种……AndWait后缀, 例如click和clickAndWait命令: cli ...

  2. selenium webdriver python 等待

    AJAX,即“Asynchronous Javascript And  XML”.可以实现网页的异步更新.也就是在不重新加载整个网页的情况下,对网页的某部分进行更新. 现在大多数网站都使用AJAX技术 ...

  3. WebDriver元素等待机制

    能否构建健壮和可靠的测试是UI自动化测试能否成功的关键因素之一.但实际情况是当一个测试接着一个测试执行的时候,常会遇到各种不同的状况.比如脚本去定位元素或去验证程序的运行状态时,有时会发现找不到元素, ...

  4. Selenium with Python 008 - WebDriver 元素等待

    如今大多数Web应用程序使用Ajax技术,当浏览器在加载页面时,页面上的元素可能并不是同时被加载完成的,这给元素的定位增加了困难.如果因为在加载某个元素时延迟而造成ElementNotVisibleE ...

  5. salesforce 零基础学习(二十七)VF页面等待(loading)效果制作

    进行查询的情况下,显示友好的等待效果可以让用户更好的了解目前的状态以及减少用户消极的等待,例如下图所示. VF提供了<apex:actionStatus>标签,,此标签用于显示一个AJAX ...

  6. WebDriver的等待方式

    /* * 1.线程休眠 * 2.隐式等待 * 3.显示等待 * */ package com.sfwork; import java.util.concurrent.TimeUnit; import ...

  7. python webdriver 显示等待-自动登录126邮箱,添加联系人

    脚本内容:#encoding=utf-8#author-夏晓旭from selenium import webdriverimport timefrom selenium.webdriver.supp ...

  8. easyui的页面等待提示层,即mask

    /* * 使用方法: * 开启:MaskUtil.mask(); * 关闭:MaskUtil.unmask(); * * MaskUtil.mask('其它提示文字...'); */ var Mask ...

  9. Java+selenium之WebDriver页面元素的操作(三)

    1. 输入框(text field or textarea) WebElement we = driver.findElement(By.id("id")); //将输入框清空 w ...

随机推荐

  1. Educational Codeforces Round 16 B

    Description You are given n points on a line with their coordinates xi. Find the point x so the sum ...

  2. js判断手机连接网络类型

    <!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml" lang="en"> ...

  3. qbxt十一系列三

    [题目分析] 这完全是个数学题啊,有些崩溃,上午考试写了两个小时,20分,于是乎 下午改啊改啊 改到10分....如果第二个圆的圆心在第一个圆.....呃 说不清楚 像下面这个图这样,两圆重叠部分中C ...

  4. VC++ 线程同步 总结

    注:所谓同步,并不是多个线程一起同时执行,而是他们协同步调,按预定的先后次序执行. 与线程相关的基本函数包括:CreateThread:创建线程CloseHandle:关闭线程句柄.注意,这只会使指定 ...

  5. 第四课 Activity

    1.Activity生命周期 1.1 创建-->启动-->获取焦点-->running-->失去焦点-->停止-->销毁.(一个正常activity的生命周期) 1 ...

  6. ruby学习总结02

    1.条件判断(nil或alse为假,其他值均为真) 1.if语句  if/elsif/else/end     条件成立时执行相关操作 2.unless语句   unless/else/end  条件 ...

  7. CodeForces 471C MUH and House of Cards

    MUH and House of Cards Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & % ...

  8. liftover的使用/用法

    Lift genome positions Genome positions are best represented in BED format. UCSC provides tools to co ...

  9. ARM指令分类学习

    指令分类: 1.算数和逻辑指令 2.比较指令 3.跳转指令 4.移位指令 5.程序状态字访问指令 6.存储器访问指令 +++++++++++++++++++++++++++++++++++++++++ ...

  10. 线程入门之join方法

    package com.thread; /** * <join:将某线程加入进来,相当于方法调用,也叫合并某个线程> * <功能详细描述> * * @author 95Yang ...