• <i id='WcTh9'><tr id='WcTh9'><dt id='WcTh9'><q id='WcTh9'><span id='WcTh9'><b id='WcTh9'><form id='WcTh9'><ins id='WcTh9'></ins><ul id='WcTh9'></ul><sub id='WcTh9'></sub></form><legend id='WcTh9'></legend><bdo id='WcTh9'><pre id='WcTh9'><center id='WcTh9'></center></pre></bdo></b><th id='WcTh9'></th></span></q></dt></tr></i><div id='WcTh9'><tfoot id='WcTh9'></tfoot><dl id='WcTh9'><fieldset id='WcTh9'></fieldset></dl></div>

      <bdo id='WcTh9'></bdo><ul id='WcTh9'></ul>

    1. <small id='WcTh9'></small><noframes id='WcTh9'>

    2. <tfoot id='WcTh9'></tfoot>
      <legend id='WcTh9'><style id='WcTh9'><dir id='WcTh9'><q id='WcTh9'></q></dir></style></legend>
      1. Selenium 等待任何元素可见

        Selenium Wait for anyone of Element to visible(Selenium 等待任何元素可见)
          <tbody id='u1JbG'></tbody>

        <tfoot id='u1JbG'></tfoot>

        <legend id='u1JbG'><style id='u1JbG'><dir id='u1JbG'><q id='u1JbG'></q></dir></style></legend>

        <small id='u1JbG'></small><noframes id='u1JbG'>

            <bdo id='u1JbG'></bdo><ul id='u1JbG'></ul>
              <i id='u1JbG'><tr id='u1JbG'><dt id='u1JbG'><q id='u1JbG'><span id='u1JbG'><b id='u1JbG'><form id='u1JbG'><ins id='u1JbG'></ins><ul id='u1JbG'></ul><sub id='u1JbG'></sub></form><legend id='u1JbG'></legend><bdo id='u1JbG'><pre id='u1JbG'><center id='u1JbG'></center></pre></bdo></b><th id='u1JbG'></th></span></q></dt></tr></i><div id='u1JbG'><tfoot id='u1JbG'></tfoot><dl id='u1JbG'><fieldset id='u1JbG'></fieldset></dl></div>

                  本文介绍了Selenium 等待任何元素可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  单击特定按钮时 - 我的测试站点将打开模式窗口.

                  While Clicking a particular button - my test site will open modal window.

                  但是打开的模态窗口是不同的,要么是用模态窗口1打开的,要么是模态窗口2打开的

                  But the modal window opens are differ, either it opened with modal window 1 or modal window 2

                  两者都有不同的标题、不同的选项和不同的定位器.现在我应该等到模态 window 打开 1 或 2.

                  Both are having different title, different options and different locators. Now I should have to wait until the modal window open Either 1 or 2.

                  是否可以等到任一模式窗口 (WebElement) 可见?

                  Is it possible to wait until either one modal window (WebElement) is visible?

                  我在 WebDriverWait 方法中搜索过,但所有方法都是等到特定的 WebElement 可见或可点击.

                  I have searched in WebDriverWait methods, but all methods are to wait until a particular WebElement to visible or clickable.

                  我找不到更好的方法来等待任何一个可见.

                  I can't find a better method to wait until either one is visible.

                  您能建议任何一种方法来解决这种情况吗?

                  Could you suggests any one method to solve this situation?

                  推荐答案

                  可以使用 预期条件

                  WebDriverWait wait = new WebDriverWait(driver, 10);
                  wait.until(ExpectedConditions.or(
                      ExpectedConditions.visibilityOfElementLocated(By.id("id1")),
                      ExpectedConditions.visibilityOfElementLocated(By.id("id2"))
                  ));
                  

                  或者使用cssSelector或者,

                  wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#id1, #id2"));
                  

                  这篇关于Selenium 等待任何元素可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Maven JAVA_HOME environment variable is not defined correctly, but it is(Maven JAVA_HOME 环境变量未正确定义,但它是)
                  Java System Environment Variable(Java 系统环境变量)
                  Java -classpath option(Java -classpath 选项)
                  Read environment variable in SpringBoot(在 SpringBoot 中读取环境变量)
                  Tomcat 8 - context.xml use Environment Variable in Datasource(Tomcat 8 - context.xml 在数据源中使用环境变量)
                  Issue with JAVA_HOME(JAVA_HOME 的问题)

                • <i id='mAEdC'><tr id='mAEdC'><dt id='mAEdC'><q id='mAEdC'><span id='mAEdC'><b id='mAEdC'><form id='mAEdC'><ins id='mAEdC'></ins><ul id='mAEdC'></ul><sub id='mAEdC'></sub></form><legend id='mAEdC'></legend><bdo id='mAEdC'><pre id='mAEdC'><center id='mAEdC'></center></pre></bdo></b><th id='mAEdC'></th></span></q></dt></tr></i><div id='mAEdC'><tfoot id='mAEdC'></tfoot><dl id='mAEdC'><fieldset id='mAEdC'></fieldset></dl></div>
                • <legend id='mAEdC'><style id='mAEdC'><dir id='mAEdC'><q id='mAEdC'></q></dir></style></legend>

                  <small id='mAEdC'></small><noframes id='mAEdC'>

                  <tfoot id='mAEdC'></tfoot>

                      <bdo id='mAEdC'></bdo><ul id='mAEdC'></ul>

                              <tbody id='mAEdC'></tbody>