win10,python3.8.10。
selenium版本如下(用pip38 show selenium查看):

在定位中,定位了一个按钮(特点:button下还有span然后才是文本),代码如下:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
confirm_button=WebDriverWait(xxx_driver, 5).until(
EC.element_to_be_clickable((By.XPATH,'//button/span[contains(text(), "确定")]'))
)
定位是没有问题的。然后执行如下点击代码:
confirm_button.click()
就会报错了:element click intercepted: Element <span>...</span> is not clickable。
解决办法:
将点击代码改为如下即可:
webdriver.ActionChains(xxx_driver).move_to_element(confirm_button).click(confirm_button).perform()
可以参考我的文章: selenium中出现 Other element would receive the click的解决方式-CSDN博客
也可以参考文章:
element click intercepted: Element <span>...</span> is not clickable报错解决办法_element click intercepted: element <span>...</span-CSDN博客
或者:
https://www.cnblogs.com/soundcode/p/15910729.html
对于这篇文章,我测试第一种方法并不好用,第二种好用。










![[创业之路-106] :经济学十大陷阱与核心思想:系统论、社会进化论、周期论、阴阳互转论](https://img-blog.csdnimg.cn/direct/8321f2069a114b0c873cd94d9d6aa463.png)





![请编写一个函数void fun(int m,int k,int xx[]),该函数的功能是:将大于整数m且紧靠m的k个素数存入xx所指的数组中。](https://img-blog.csdnimg.cn/direct/66bf5daaf2034bb78d80a4f6f1668b89.png)



