• <tfoot id='NSy9y'></tfoot><legend id='NSy9y'><style id='NSy9y'><dir id='NSy9y'><q id='NSy9y'></q></dir></style></legend>

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

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

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

        您如何修复“元素不可交互"?例外?

        时间:2023-07-04
        <tfoot id='FfZ9K'></tfoot>
      1. <i id='FfZ9K'><tr id='FfZ9K'><dt id='FfZ9K'><q id='FfZ9K'><span id='FfZ9K'><b id='FfZ9K'><form id='FfZ9K'><ins id='FfZ9K'></ins><ul id='FfZ9K'></ul><sub id='FfZ9K'></sub></form><legend id='FfZ9K'></legend><bdo id='FfZ9K'><pre id='FfZ9K'><center id='FfZ9K'></center></pre></bdo></b><th id='FfZ9K'></th></span></q></dt></tr></i><div id='FfZ9K'><tfoot id='FfZ9K'></tfoot><dl id='FfZ9K'><fieldset id='FfZ9K'></fieldset></dl></div>

          <tbody id='FfZ9K'></tbody>
      2. <legend id='FfZ9K'><style id='FfZ9K'><dir id='FfZ9K'><q id='FfZ9K'></q></dir></style></legend>

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

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

                  本文介绍了您如何修复“元素不可交互"?例外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道这已经被问过很多次了,但是您如何解决元素不可交互"异常?

                  I know this has been asked lots of times before but how do you get around the "element not interactable" exception?

                  我是 Selenium 的新手,如果我有什么问题,请见谅.

                  I'm new to Selenium so excuse me if I get something wrong.

                  这是我的代码:

                  button = driver.find_element_by_class_name(u"infoDismiss")
                  type(button)
                  button.click()
                  driver.implicitly_wait(10)
                  

                  这是 HTML:

                  <button class="dismiss infoDismiss">
                      <string for="inplay_button_dismiss">Dismiss</string>
                  </button>
                  

                  这是错误信息:

                  selenium.common.exceptions.ElementNotInteractableException: Message: 
                  

                  在说消息之后实际上什么都没有.

                  After is says message there is literally nothing.

                  我花了很多时间在网上搜索,但没有找到任何可以解决我问题的东西.非常感谢您的回答.

                  I have spent lots of time searching the web, not finding anything that solves my issue. I would really appreciate an answer.

                  提前致谢.

                  将w"更改为驱动程序,以便于阅读

                  Changed "w" to driver so it is easier to read

                  更新:我刚刚意识到我找到了错误按钮的 HTML!真正的按钮 HTML 如下:

                  Update: I have just realized that I've found the HTML of the wrong button! The real button HTML is below:

                  <button class="dismiss">
                      <string for="exit">Dismiss</string>
                  </button>
                  

                  另外,我使用了答案和评论并编辑了我的代码,如下所示:

                  Also, I've used the answers and comments and edited my code to look like this:

                  button = driver.find_element_by_css_selector("button.dismiss")
                  w.implicitly_wait(10)
                  ActionChains(w).move_to_element(button).click(button)
                  

                  现在我得到一个新错误:

                  And now I get a new error:

                  selenium.common.exceptions.WebDriverException: Message: Tried to run command without establishing a connection
                  

                  错误发生在第 1 行:button = driver.find_element_by_css_selector("button.dismiss")

                  The error happens in line 1: button = driver.find_element_by_css_selector("button.dismiss")

                  注意:非常感谢所提供的帮助,谢谢

                  Note: I really appreciate the help that has been given, thanks

                  推荐答案

                  有一种可能是该元素当前不可点击,因为它不可见.造成这种情况的原因可能是另一个元素覆盖了它,或者它不在视图中,即它在当前可见区域之外.

                  A possibility is that the element is currently unclickable because it is not visible. Reasons for this may be that another element is covering it up or it is not in view, i.e. it is outside the currently view-able area.

                  试试这个

                  from selenium.webdriver.common.action_chains import ActionChains
                  
                  button = driver.find_element_by_class_name(u"infoDismiss")
                  driver.implicitly_wait(10)
                  ActionChains(driver).move_to_element(button).click(button).perform()
                  

                  这篇关于您如何修复“元素不可交互"?例外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何为 python selenium 3.8.0 设置'driver.get'的超时? 下一篇:用于处理弹出浏览器窗口的 Python webdriver 不是警报

                  相关文章

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

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