selenium - 常見問題(二)按鈕點擊報錯:ElementClickInterceptedException


按鈕點擊報錯:selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button type="button" class="ant-btn ant-btn-primary">...</button> is not clickable at point (1013, 212). Other element would receive the click: 

第一種方式若報錯,可以使用二三方式:

driver.find_element_by_xpath('/html/body/div[6]/div/div[2]/div/div[2]/div/div/div[2]/button[2]').click()   # 普通的元素點擊方式
element = driver.find_element_by_xpath('/html/body/div[6]/div/div[2]/div/div[2]/div/div/div[2]/button[2]')
ActionChains(driver).move_to_element(element).click().perform()     # 使用鼠標點擊的方式
driver.find_element_by_xpath('/html/body/div[6]/div/div[2]/div/div[2]/div/div/div[2]/button[2]').send_keys(Keys.ENTER)   # 使用鍵盤回車鍵的方式

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM