Selenium: 处理 ElementClickInterceptedException 错误 - 按钮点击被拦截
"{ElementClickInterceptedException}Message: element click intercepted: Element <button type="button" class="weui-desktop-btn weui-desktop-btn_default">...</button> is not clickable at point (1167, 19). Other element would receive the click: <div class="weui-cls-modal_wraper abilities-conf-modal" style="">...</div>"\nSeleniumr如何判断按钮是否可以点击到内容:在Selenium中,可以使用element.is_enabled()方法来判断一个按钮是否可以点击到。该方法会返回一个布尔值,如果按钮可以点击则返回True,否则返回False。\n\n你可以在点击按钮之前先判断按钮是否可点击,例如:\n\npython\nbutton = driver.find_element_by_xpath("//button[@class='weui-desktop-btn weui-desktop-btn_default']\")\nif button.is_enabled():\n button.click()\nelse:\n print("按钮不可点击")\n\n\n在上述代码中,is_enabled()方法会判断按钮是否可点击,如果返回True,则调用click()方法点击按钮。如果返回False,则输出"按钮不可点击"的提示信息。\n\n另外,根据你提供的错误信息,可能是因为有一个遮罩层(div元素)挡住了按钮,导致按钮无法被点击。你可以尝试先关闭或移除遮罩层,然后再点击按钮。
原文地址: https://www.cveoy.top/t/topic/qqnR 著作权归作者所有。请勿转载和采集!