Element * is not clickable at point,Other element would receive the click:Python 爬虫点击报错,事件被覆盖,完美解决!

环境:
python3.6 + selenium 3.11 + chromedriver.exe

错误简述:
Element * is not clickable at point,Other element would receive the click

功能需求:
点击查看更多,获取页面数据
Element * is not clickable at point,Other element would receive the click:Python 爬虫点击报错,事件被覆盖,完美解决!_第1张图片
源代码如下

show_more = driver.find_element_by_xpath('//tbody[@class="ant-table-tbody"]/tr/td/a')
show_more.click()

报错信息:

selenium.common.exceptions.WebDriverException: Message: unknown error:
Element * is not clickable at point (817, 751).
Other element would receive the click: *

错误解释:
a标签被点击时,被上一层td标签接收了点击,说明a标签被覆盖了!

解决办法:

show_more = driver.find_element_by_xpath('//tbody[@class="ant-table-tbody"]/tr/td/a')

##方法1
show_more.send_keys('\n')
show_more.click()

##方法2
show_more.send_keys(Keys.SPACE)
show_more.click()

# 方法3
driver.execute_script("arguments[0].click();", show_more)

python交流群:1135250278
公众号:柚米汇
欢迎大家来支持我下,谢谢!
Element * is not clickable at point,Other element would receive the click:Python 爬虫点击报错,事件被覆盖,完美解决!_第2张图片

你可能感兴趣的:(技术类,python,软件测试)