ElementClickInterceptedException: Message: Element is not clickable at point (x,y) because another element obscures it

青春壹個敷衍的年華 提交于 2021-02-10 06:23:08

问题


Hi I continue to get the error, ElementClickInterceptedException: Message: Element is not clickable at point (x,y) because another element obscures it

I have tried many work arounds including a time delay and nothing seems to work. i tried some of the solutions here: Selenium Web Driver & Java. Element is not clickable at point (x, y). Other element would receive the click

then I get a new error, "cannot scroll down"

Appreciate any help. Here is my code:

from selenium import webdriver
import time

    browser = webdriver.Firefox()
    browser.get('https://keepa.com/#!')
    browser.implicitly_wait(2)
#login to site
    isbn = browser.find_element_by_id('panelUserRegisterLogin').click()
    isbn = browser.find_element_by_id('username')
    isbn.send_keys('xxxx')
    isbn = browser.find_element_by_id('password')
    isbn.send_keys('xxxx')
    isbn = browser.find_element_by_id('submitLogin').click()
  #open search bar and lookup asin

    isbn = browser.find_element_by_id('menuSearch').click()
    isbn = browser.find_element_by_id('searchInput')
    isbn.send_keys(xxxx)
    isbn.submit()

回答1:


As I mentioned earlier it's duplicate of the Element is not clickable at point (x, y), where you can find detailed reasons and explanation of the error.
Here's correct code:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec

browser = webdriver.Chrome()
wait = WebDriverWait(browser, 5)

browser.get("https://keepa.com/#!")

#login to site
wait.until(ec.element_to_be_clickable((By.ID, "panelUserRegisterLogin"))).click()
browser.find_element_by_id("username").send_keys("xxxx")
browser.find_element_by_id("password").send_keys("xxxx")
browser.find_element_by_id("submitLogin").click()

#open search bar and lookup asin
wait.until(ec.invisibility_of_element_located((By.ID, "loginOverlay")))
wait.until(ec.element_to_be_clickable((By.ID, "showSearchBar"))).click()

search_input = wait.until(ec.element_to_be_clickable((By.ID, "searchInput")))
search_input.send_keys("xxxx")
search_input.submit()


来源:https://stackoverflow.com/questions/58255396/elementclickinterceptedexception-message-element-is-not-clickable-at-point-x

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!