<bdo id='U9XsV'></bdo><ul id='U9XsV'></ul>
  • <small id='U9XsV'></small><noframes id='U9XsV'>

    <tfoot id='U9XsV'></tfoot>

      1. <legend id='U9XsV'><style id='U9XsV'><dir id='U9XsV'><q id='U9XsV'></q></dir></style></legend>

        <i id='U9XsV'><tr id='U9XsV'><dt id='U9XsV'><q id='U9XsV'><span id='U9XsV'><b id='U9XsV'><form id='U9XsV'><ins id='U9XsV'></ins><ul id='U9XsV'></ul><sub id='U9XsV'></sub></form><legend id='U9XsV'></legend><bdo id='U9XsV'><pre id='U9XsV'><center id='U9XsV'></center></pre></bdo></b><th id='U9XsV'></th></span></q></dt></tr></i><div id='U9XsV'><tfoot id='U9XsV'></tfoot><dl id='U9XsV'><fieldset id='U9XsV'></fieldset></dl></div>
      2. 如何解决 ElementNotInteractableException:元素在 Selenium webdriver

        How to resolve ElementNotInteractableException: Element is not visible in Selenium webdriver?(如何解决 ElementNotInteractableException:元素在 Selenium webdriver 中不可见?)
          <tbody id='wG9Q5'></tbody>

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

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

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

                  问题描述

                  这里有我的代码图像和错误图像.谁能帮我解决这个问题?

                  Here I have the image of my code and the image of my error. Can anyone help me to resolve this issue?

                  推荐答案

                  ElementNotInteractableException

                  ElementNotInteractableException 是 W3C 异常,它被抛出以表明虽然元素存在于 HTML DOM,它不是处于可以交互的状态.

                  ElementNotInteractableException

                  ElementNotInteractableException is the W3C exception which is thrown to indicate that although an element is present on the HTML DOM, it is not in a state that can be interacted with.

                  ElementNotInteractableException 发生的原因有很多.

                  1. 我们感兴趣的 WebElement 上的其他 WebElement 的临时覆盖:

                  1. Temporary Overlay of other WebElement over the WebElement of our interest :

                  在这种情况下,直接的解决方案是引入 ExplicitWaitWebDriverWaitExpectedCondition as invisibilityOfElementLocated 如下:

                  In this case, the direct solution would have been to induce ExplicitWait i.e. WebDriverWait in combination with ExpectedCondition as invisibilityOfElementLocated as folllows:

                  WebDriverWait wait2 = new WebDriverWait(driver, 10);
                  wait2.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("xpath_of_element_to_be_invisible")));
                  driver.findElement(By.xpath("xpath_element_to_be_clicked")).click();
                  

                  更好的解决方案是更细化,而不是使用 ExpectedCondition 作为 invisibilityOfElementLocated 我们可以使用 ExpectedCondition 作为 elementToBeClickable 如下:

                  A better solution will be to get a bit more granular and instead of using ExpectedCondition as invisibilityOfElementLocated we can use ExpectedCondition as elementToBeClickable as follows:

                  WebDriverWait wait1 = new WebDriverWait(driver, 10);
                  WebElement element1 = wait1.until(ExpectedConditions.elementToBeClickable(By.xpath("xpath_of_element_to_be_clicked")));
                  element1.click();
                  

                • 将其他 WebElement 永久覆盖在我们感兴趣的 WebElement:

                • Permanent Overlay of other WebElement over the WebElement of our interest :

                  如果在这种情况下叠加层是永久的,我们必须将 WebDriver 实例转换为 JavascriptExecutor并执行如下点击操作:

                  If the overlay is a permanent one in this case we have to cast the WebDriver instance as JavascriptExecutor and perform the click operation as follows:

                  WebElement ele = driver.findElement(By.xpath("element_xpath"));
                  JavascriptExecutor executor = (JavascriptExecutor)driver;
                  executor.executeScript("arguments[0].click();", ele);
                  

                • 这篇关于如何解决 ElementNotInteractableException:元素在 Selenium webdriver 中不可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                  <legend id='DqWxi'><style id='DqWxi'><dir id='DqWxi'><q id='DqWxi'></q></dir></style></legend>
                    <tfoot id='DqWxi'></tfoot>
                    1. <i id='DqWxi'><tr id='DqWxi'><dt id='DqWxi'><q id='DqWxi'><span id='DqWxi'><b id='DqWxi'><form id='DqWxi'><ins id='DqWxi'></ins><ul id='DqWxi'></ul><sub id='DqWxi'></sub></form><legend id='DqWxi'></legend><bdo id='DqWxi'><pre id='DqWxi'><center id='DqWxi'></center></pre></bdo></b><th id='DqWxi'></th></span></q></dt></tr></i><div id='DqWxi'><tfoot id='DqWxi'></tfoot><dl id='DqWxi'><fieldset id='DqWxi'></fieldset></dl></div>

                        <tbody id='DqWxi'></tbody>

                        • <bdo id='DqWxi'></bdo><ul id='DqWxi'></ul>

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