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

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

        如何解决此问题元素不可交互的 Selenium Python

        时间:2023-10-08

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

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

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

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

                  本文介绍了如何解决此问题元素不可交互的 Selenium Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我的脚本代码中有以下行,我从 Selenium IDE 获得的 XPath 工作正常:

                  I have the following line in my script code, where the XPath I got it from Selenium IDE that works fine:

                  driver.find_element_by_xpath("(//a[contains(@href, '')])[20]").click()
                  

                  自动化测试在此处停止并出现此错误:

                  An automation test stops here with this error:

                  Traceback (most recent call last):
                  File "Script.py", line 65, in <module>
                      driver.find_element_by_xpath("//a[contains(@href, '')])[20]").click()
                  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 80, in click
                      self._execute(Command.CLICK_ELEMENT)
                  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
                      return self._parent.execute(command, params)
                  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
                      self.error_handler.check_response(response)
                  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
                      raise exception_class(message, screen, stacktrace)
                  selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable
                  (Session info: chrome=74.0.3729.131)
                  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 6.1.7601 SP1 x86_64)
                  

                  如何解决这个问题?

                  感谢您的帮助.

                  推荐答案

                  既然你只是想抓取数据,我推荐你使用这个方案:

                  Seeing as you just want to scrape the data, I recommend you use this solution:

                  element = driver.find_element_by_xpath("(//a[contains(@href, '')])[20]")
                  driver.execute_script("arguments[0].click();", element)
                  

                  通过 Javascript 点击元素,而不是 selenium 使用的自然"点击(试图模拟用户体验).

                  Which clicks the element via Javascript as opposed to a "natural" click that selenium uses (to try to simulate the user experience).

                  我在这里回答了一个类似的问题,该问题也链接到另一个帖子.

                  I answered a similar question here that links to another post on it as well.

                  这篇关于如何解决此问题元素不可交互的 Selenium Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:获取 chrome 性能和跟踪日志 下一篇:如何使用带有 python、selenium 和 chromedriver 的 Bra

                  相关文章

                  最新文章

                • <tfoot id='lePUJ'></tfoot>

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

                    • <bdo id='lePUJ'></bdo><ul id='lePUJ'></ul>
                      <legend id='lePUJ'><style id='lePUJ'><dir id='lePUJ'><q id='lePUJ'></q></dir></style></legend>