From 5eb369d13a3ede27a3060580b2d2e8b4528c7b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E5=AE=87=E7=90=A6?= <465615774@qq.com> Date: Mon, 25 May 2020 12:57:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E7=88=B6=E5=B1=82?= =?UTF-8?q?=E7=AA=97=E4=BD=93=E6=97=B6=E6=97=A0=E6=B3=95=E5=88=87=E5=88=B0?= =?UTF-8?q?=E9=A1=B6=E5=B1=82=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auxiliary/work/selenium/element/AbstractBy.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/pres/auxiliary/work/selenium/element/AbstractBy.java b/src/main/java/pres/auxiliary/work/selenium/element/AbstractBy.java index 7fa0cab..8f87d23 100644 --- a/src/main/java/pres/auxiliary/work/selenium/element/AbstractBy.java +++ b/src/main/java/pres/auxiliary/work/selenium/element/AbstractBy.java @@ -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; /** *

文件名:AbstractElement.java

@@ -259,6 +258,12 @@ public abstract class AbstractBy { * @param elementInformationList 存储窗体的名称或xpath与css定位方式的List集合 */ void switchFrame(List frameNameList) { + //若传参为空,则切回到顶层 + if (frameNameList.isEmpty()) { + switchRootFrame(); + } + + //若不为空,则列表进行切换 frameNameList.forEach(frameName -> { //判断name指向的窗体是否在iframeNameList中,若存在,则向上切换父层,直到切换到name指向的窗体;若不存在,则直接切换,并添加窗体名称 if (iframeNameList.contains(frameName)) {