修复无父层窗体时无法切到顶层的问题

This commit is contained in:
彭宇琦 2020-05-25 12:57:48 +08:00
parent c76487a31b
commit 5eb369d13a
1 changed files with 8 additions and 3 deletions

View File

@ -12,11 +12,10 @@ import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import pres.auxiliary.selenium.event.NoSuchWindownException;
import pres.auxiliary.selenium.xml.ByType;
import pres.auxiliary.selenium.xml.ReadXml;
import pres.auxiliary.work.selenium.brower.AbstractBrower;
import pres.auxiliary.work.selenium.brower.Page;
import pres.auxiliary.work.selenium.xml.ByType;
import pres.auxiliary.work.selenium.xml.ReadXml;
/**
* <p><b>文件名</b>AbstractElement.java</p>
@ -259,6 +258,12 @@ public abstract class AbstractBy {
* @param elementInformationList 存储窗体的名称或xpath与css定位方式的List集合
*/
void switchFrame(List<String> frameNameList) {
//若传参为空则切回到顶层
if (frameNameList.isEmpty()) {
switchRootFrame();
}
//若不为空则列表进行切换
frameNameList.forEach(frameName -> {
//判断name指向的窗体是否在iframeNameList中若存在则向上切换父层直到切换到name指向的窗体若不存在则直接切换并添加窗体名称
if (iframeNameList.contains(frameName)) {