問題描述
我目前正在從事一個自動填寫表格的項目.填寫表格時會出現下一個按鈕,這就是它給我一個錯誤的原因.
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,"http://input[@type='button' and @class='button']")))
Next = driver.find_element_by_xpath("http://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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!