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

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

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

      1. <tfoot id='rdsDW'></tfoot>

        如何在 Chrome 中单击通过 webdriver 通过 Ajax 加载的

        时间:2023-09-03

      2. <legend id='MIFFO'><style id='MIFFO'><dir id='MIFFO'><q id='MIFFO'></q></dir></style></legend>
          <bdo id='MIFFO'></bdo><ul id='MIFFO'></ul>
        • <small id='MIFFO'></small><noframes id='MIFFO'>

            1. <tfoot id='MIFFO'></tfoot>
            2. <i id='MIFFO'><tr id='MIFFO'><dt id='MIFFO'><q id='MIFFO'><span id='MIFFO'><b id='MIFFO'><form id='MIFFO'><ins id='MIFFO'></ins><ul id='MIFFO'></ul><sub id='MIFFO'></sub></form><legend id='MIFFO'></legend><bdo id='MIFFO'><pre id='MIFFO'><center id='MIFFO'></center></pre></bdo></b><th id='MIFFO'></th></span></q></dt></tr></i><div id='MIFFO'><tfoot id='MIFFO'></tfoot><dl id='MIFFO'><fieldset id='MIFFO'></fieldset></dl></div>
                <tbody id='MIFFO'></tbody>
                  本文介绍了如何在 Chrome 中单击通过 webdriver 通过 Ajax 加载的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  浏览器:Chrome V65

                  Browser : Chrome V65

                  ChromeDriver:chromedriver.exe 2.37

                  ChromeDriver: chromedriver.exe 2.37

                  webdriver 尝试单击元素时发生错误.下面是我的click():

                  Error occurs while webdriver trying to click an element. The below is my click():

                  def click(self):
                      try:
                          self.wait_for().visible()
                          self._selenium_context().click()
                      except Exception as e:
                          raise NoSuchElementException
                  
                  def visible(self):
                      '''
                      Check if the element is visible.
                      :return:  True or exception.
                      '''
                      return Utils.wait_for(self.web_element.visible, self.interval, self.timeout)
                  

                  我已经等待元素可见,然后单击.但是抛出异常说其他元素将收到点击"如下:

                  I had already waited for element visible and then clicked. But exception was thrown saying 'Other element would receive the click' as below:

                  selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div class="learn-wrap" ng-click="changeTab(2)" ng-class="internal.tab == 2?'learn-selected':''">...</div> is not clickable at point (1026, 89). Other element would receive the click: <div class="loading-data ng-scope ng-animate ng-leave ng-leave-active" ng-if="internal.isAjaxing" data-ng-animate="2" style="">...</div>
                  

                  即使我添加语句以等待 ajax 加载完成以单击元素,也会发生错误:

                  Error occurs even if I add statement to wait ajax loading finished to click the element:

                  driver.find_element(By.XPATH, "//div[contains(@class, 'learn') and (contains(@ng-if, '!internal.isAjaxing'))]")
                  driver.find_element(By.XPATH , element_xpath).click()
                  

                  这种情况在 Chrome 上经常发生,可能 5 次中有 4 次失败.没用!

                  This happens on Chrome frequently, maybe 4 in 5 times failure. It doesn't work!

                  现在,我必须使用 sleep 来等待元素变为可点击.

                  Now, I have to use sleep to wait element to be clickable instead.

                  有人可以帮忙吗?谢谢.

                  Can anybody help? Thanks.

                  推荐答案

                  可以使用action类点击元素,

                  You can use action class to click element,

                  语法:

                  Actions action = new Actions(driver);
                  action.moveToElement("Your Element").click().perform();
                  

                  这篇关于如何在 Chrome 中单击通过 webdriver 通过 Ajax 加载的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在运行测试时放宽 Chrome 的 CSP (webdriver) (Content- 下一篇:DynamoDB Javascript – 按主键和范围键数组查询?

                  相关文章

                  最新文章

                  <tfoot id='pSuOQ'></tfoot>
                      <bdo id='pSuOQ'></bdo><ul id='pSuOQ'></ul>

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

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