问题描述
我目前正在从事一个自动填写表格的项目.填写表格时会出现下一个按钮,这就是它给我一个错误的原因.
I am currently working on a project which fills a form automatically. And the next button appears when the form is filled, that's why it gives me an error.
我试过了:
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,"//input[@type='button' and @class='button']")))
Next = driver.find_element_by_xpath("//input[@type='button' and @class='button']")
Next.click()
HTML:
<span class="btn">
<input type="button" value="Next" class="button" payoneer="Button" data-controltovalidate="PersonalDetails" data-onfieldsvalidation="ToggleNextButton" data-onclick="UpdateServerWithCurrentSection();" id="PersonalDetailsButton">
</input>
<div class="clearfix"></div>
</span>
错误:
selenium.common.exceptions.ElementClickInterceptedException:消息:元素点击被拦截:元素在点 (203, 530) 处不可点击.其他元素会收到点击:... (Session info: chrome=76.0.3809.132)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (203, 530). Other element would receive the click: ... (Session info: chrome=76.0.3809.132)
推荐答案
如果xpath的路径是对的,或许你可以试试这个方法来解决这个问题.将旧代码替换为以下代码:
If the path of the xpath is right, maybe you can try this method to solve this problem. Replace the old code with the following code:
button = driver.find_element_by_xpath("xpath")
driver.execute_script("arguments[0].click();", button)
我以前解决过这个问题,但老实说,我不知道原因.
I solved this problem before, but to be honestly, I don't know the reason.
这篇关于selenium.common.exceptions.ElementClickInterceptedException:消息:元素点击被拦截:元素不可点击 Selenium 和 Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!