public class WaitEvent extends AbstractEvent
文件名:WaitEvent.java
用途: 定义了对元素进行特殊事件等待的方法,包括等待控件消失、等待控件出现文字等, 可通过该类,等待元素进行一定的变化的操作
编码时间:2020年10月19日上午7:21:05
修改时间:2020年10月19日上午7:21:05
brower, exceptionSet, isLocationElement, LOCATION_ELEMENT_JS, wait, waitTime, webElement
Constructor and Description |
---|
WaitEvent(AbstractBrower brower)
构造对象
|
WaitEvent(AbstractBrower brower,
long waitTime)
构造对象
|
Modifier and Type | Method and Description |
---|---|
boolean |
appear(Element element)
该方法用于根据元素信息,在元素被加载后,等待元素在页面中出现,并返回元素出现的结果
|
boolean |
disappear(Element element)
用于等待元素消失,若元素无法获取到,则也判定为元素不存在
|
void |
setOvertime(long overtime)
用于设置元素查询超时时间,单位为秒
|
boolean |
showText(Element element,
String... keys)
该方法用于等待指定元素中显示相应的文本,可指定显示文本的关键词,直到显示相应的关键词为止,
若不传入关键词,则只判断元素加载出文本。若元素未出现,则返回false
|
actionOperate, arrayToString, getBrower, getExceptionInfomation, isExistElement, locationElement, setLocationElement, setWaitTime
public WaitEvent(AbstractBrower brower)
brower
- 浏览器AbstractBrower
类对象public WaitEvent(AbstractBrower brower, long waitTime)
brower
- 浏览器AbstractBrower
类对象public void setOvertime(long overtime)
overtime
- 超时时间public boolean disappear(Element element)
element
- Element
对象org.openqa.selenium.TimeoutException
- 等待超时时抛出的异常public boolean appear(Element element)
注意:
UnsupportedCommandException
异常element
- Element
对象org.openqa.selenium.TimeoutException
- 等待超时时抛出的异常org.openqa.selenium.UnsupportedCommandException
- 使用app元素进行等待时抛出的异常Copyright © 2024. All rights reserved.