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

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

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

      ElementClickInterceptedException:消息:元素单击被拦截元

      时间:2023-10-14

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

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

              • <bdo id='WycQo'></bdo><ul id='WycQo'></ul>
                本文介绍了ElementClickInterceptedException:消息:元素单击被拦截元素不可点击错误单击使用 Selenium 和 Python 的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在尝试单击第一个框(ASN/DSD)

                I am trying to click on the first box (ASN / DSD)

                但我收到此错误消息:

                selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: 
                Element <input type="radio" name="docTypes" ng-model="$ctrl.documentTypes.selected" id="documentType-0" ng-change="$ctrl.onChangeDocumentType()" ng-value="documentType" tabindex="0" class="ng-pristine ng-untouched ng-valid ng-empty" value="[object Object]" aria-invalid="false"> 
                is not clickable at point (338, 202). 
                Other element would receive the click:
                 <label translate-attr="{title: 'fulfillment.documentAction.createNew.modal.documentType.document.title'}" translate-values="{documentName: documentType.name}" for="documentType-0" translate="ASN - DSD" tabindex="0" title="Select ASN - DSD document type">...</label>
                  (Session info: chrome=83.0.4103.116)
                

                我知道我输入了正确的 iframe,因为它可以找到元素,而不是点击它.我的代码是

                I know I have entered the right iframe because it can find the element, just not click on it. My code is

                driver.switch_to.default_content()
                iframes = driver.find_elements_by_tag_name("iframe")
                driver.switch_to.frame(iframes[0])
                time.sleep(5)
                driver.find_element_by_xpath('//*[@id="documentType-0"]').click()
                

                我看到 DebanjanB 在这里回答了类似的问题:链接

                I saw that DebanjanB answered a similar question on here: link

                我正在尝试使用执行脚本的第三个解决方案.我不知道该模型使用什么 CSS 选择器.模型是这样的

                I am trying to do his third solution of using execute script. I don't know what CSS selector to use for this model. The model looks like this

                WebDriverWait(driver, 20).until(EC.invisibility_of_element((By.CSS_SELECTOR, "span.taLnk.ulBlueLinks")))
                driver.execute_script("arguments[0].click();", WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='loadingWhiteBox']"))))
                

                我的问题是我需要在第一行使用什么 css 选择器,然后它只是我在第二行使用的初始 xpath?

                My question is what css selector do I need to use on the first line, and then is it just initial xpath I was using on the second line?

                这是供参考的 HTML.当我尝试点击输入部分时,我收到点击拦截错误.如果使用xpath点击标签标签,它不会出错但也不会点击它.它只是移动到下一段代码而不做任何事情.

                Here is the HTML for reference. I get the click intercept error when I try to click on the input section. If use xpath to click on the label tag, it does not error out but also does not click on it. It just moves on to the next section of code without doing anything.

                <li ng-repeat="documentType in selectDocumentType.documentTypes.displayedList |
                orderBy:selectDocumentType.formOrder"> 
                
                <input type="radio" name="docTypes" ng
                model="selectDocumentType.documentTypes.selected" id="documentType-0" ng-value="documentType"
                tabindex="0" class="ng-valid ng-not-empty ng-dirty ng-valid-parse ng-touched" value="[object Object]"
                aria-invalid="false"> 
                
                <label translate-attr="{title:'fulfillment.documentAction.createNew.modal.documentType.document.title'}" 
                translate-values={documentName: documentType.name}" for="documentType-0" translate="ASN - DSD" tabindex="0" title=
                "Select ASN - DSD document type"><span>ASN - DSD</span></label> </li>
                

                关于如何停止点击被拦截的任何建议?

                Any suggestions on how to stop having the click intercepted?

                推荐答案

                这个错误信息...

                selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: 
                Element <input type="radio" name="docTypes" ng-model="$ctrl.documentTypes.selected" id="documentType-0" ng-change="$ctrl.onChangeDocumentType()" ng-value="documentType" tabindex="0" class="ng-pristine ng-untouched ng-valid ng-empty" value="[object Object]" aria-invalid="false"> 
                is not clickable at point (338, 202). 
                Other element would receive the click:
                 <label translate-attr="{title: 'fulfillment.documentAction.createNew.modal.documentType.document.title'}" translate-values="{documentName: documentType.name}" for="documentType-0" translate="ASN - DSD" tabindex="0" title="Select ASN - DSD document type">...</label>
                

                ...暗示所需元素不可点击,因为某些其他元素会遮挡它.

                ...implies that the desired element wasn't clickable as some other element obscures it.

                所需的元素是 Angular 元素,以便在元素上调用 click()您必须为 element_to_be_clickable() 并且您可以使用以下任一定位器策略:

                The desired element is a Angular element so to invoke click() on the element you have to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

                • 使用 CSS_SELECTOR:

                WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "label[for='documentType-0']"))).click()
                

              • 使用 XPATH:

                WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//label[@for='documentType-0']"))).click()
                

              • 注意:您必须添加以下导入:

              • Note : You have to add the following imports :

                from selenium.webdriver.support.ui import WebDriverWait
                from selenium.webdriver.common.by import By
                from selenium.webdriver.support import expected_conditions as EC
                

              • 您也可以使用 execute_script() 方法,如下所示:

                As an alternative you can use the execute_script() method as follows:

                • 使用 CSS_SELECTOR:

                driver.execute_script("arguments[0].click();", WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "label[for='documentType-0']"))))
                

              • 使用 XPATH:

                driver.execute_script("arguments[0].click();", WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//label[@for='documentType-0']"))))
                

              • 您可以在以下位置找到一些相关讨论:

                You can find a couple of relevant discussions in:

                • 元素MyElement 在 (x, y) 点不可点击……其他元素会收到点击
                • Selenium Web 驱动程序和爪哇.元素在点 (x, y) 处不可点击.其他元素会收到点击
                • ElementClickInterceptedException:消息:元素点击被拦截:元素不是可通过 Selenium 和 Python 进行点击

                这篇关于ElementClickInterceptedException:消息:元素单击被拦截元素不可点击错误单击使用 Selenium 和 Python 的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:“站点 url"中发生错误:未捕获的类型错误:无 下一篇:Selenium WebDriver 从 CSS 属性“内容"获取文本在

                相关文章

                最新文章

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

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

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

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