本文是本人python爬虫学习时候,遇到的常见问题

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

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

功能需求:
点击查看更多,获取页面数据

源代码如下

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)

如有问题请评论区留言!