Selenium中错误:selenium.common.exceptions.ElementClickInterceptedException: Message: element click inte

今天用selenium尝试做网页测试的时候遇到一个错误:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button onclick="kwdGoSearch($('#kwdselectid').val());">...</button> is not clickable at point (660, 229). Other element would receive the click: <div id="work_position_click_center_right" class="con">...</div>
  (Session info: chrome=80.0.3987.149)

原因:
应该是元素定位相互覆盖。

解决办法:

将:

driver.find_element_by_css_selector('.ush button').click()

改为:

element1 = driver.find_element_by_css_selector('.ush button')
driver.execute_script("arguments[0].click();", element1)

你可能感兴趣的:(#,Test)