public abstract class AbstractEvent extends Object
文件名:AbstractEvent.java
用途:所有事件类的基类,包含了事件类所用到的基础方法以及弹窗处理方法和窗体、窗口的切换方法
编码时间:2019年9月24日下午4:24:15
修改时间:2021年4月17日 下午12:47:25
Modifier and Type | Field and Description |
---|---|
protected AbstractBrower |
brower
用于存储浏览器对象
|
protected HashSet<String> |
exceptionSet |
protected boolean |
isLocationElement
指向当前是否需要自动定位到元素所在位置
|
protected String |
LOCATION_ELEMENT_JS
定义定位到元素相应位置的js代码
|
protected org.openqa.selenium.support.ui.WebDriverWait |
wait
用于存储事件等待事件
|
protected long |
waitTime
设置显示等待的超时时间(默认3秒)
|
protected org.openqa.selenium.WebElement |
webElement
存储当前操作的元素类
|
Constructor and Description |
---|
AbstractEvent(AbstractBrower brower)
构造对象并存储浏览器对象
|
Modifier and Type | Method and Description |
---|---|
protected String |
actionOperate(Element element,
Function<Element,String> action)
用于对元素进行指定操作,并统一处理异常情况。
|
protected String |
arrayToString(String... keys)
用于将字符串数组内容转成字符串形式返回
|
protected AbstractBrower |
getBrower()
用于返回当前指向的
AbstractBrower 类对象 |
Set<String> |
getExceptionInfomation()
用于返回当前在执行等待时被捕获的异常信息集合
|
protected boolean |
isExistElement(Element element)
用于判断元素是否存在
|
protected void |
locationElement(org.openqa.selenium.WebElement element)
用于通过js脚本,将页面定位元素所在位置
|
void |
setLocationElement(boolean isLocationElement)
用于设置是否将页面移至元素所在的位置
|
void |
setWaitTime(long waitTime)
用于设置事件等待时间,默认时间为5秒
|
protected final String LOCATION_ELEMENT_JS
protected AbstractBrower brower
protected org.openqa.selenium.support.ui.WebDriverWait wait
protected long waitTime
protected org.openqa.selenium.WebElement webElement
protected boolean isLocationElement
public AbstractEvent(AbstractBrower brower)
brower
- 浏览器AbstractBrower
对象public void setWaitTime(long waitTime)
waitTime
- 事件等待时间public void setLocationElement(boolean isLocationElement)
isLocationElement
- 是否将页面移至元素所在的位置public Set<String> getExceptionInfomation()
protected AbstractBrower getBrower()
AbstractBrower
类对象AbstractBrower
类对象protected void locationElement(org.openqa.selenium.WebElement element)
element
- Element
对象protected boolean isExistElement(Element element)
element
- Element
对象protected String arrayToString(String... keys)
keys
- 字符串数组Copyright © 2024. All rights reserved.