alexmosk25
alexmosk25

Reputation: 134

Not able to click on a link. I'm getting the error 'Element is not clickable at point'

Can't click link. I see error

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

My code:


URL = "https://lenta.com/goods-actions/weekly-products/"
driver = webdriver.Firefox()
driver.get(URL)
time.sleep(2)

# ans = driver.find_element_by_link_text("Казань") this link works OK
ans = driver.find_element_by_link_text("Санкт-Петербург") # ERROR
ans.click()
time.sleep(5)
print("go next")
driver.get(URL)

Important code doesn't work only for "Санкт-Петербург"

Upvotes: 0

Views: 96

Answers (1)

orde
orde

Reputation: 5273

There are 2 text strings with a value of "Санкт-Петербур" on this page. One is in the overlay; one is in the page header. The script is trying to click the link in the header (but can't because the overlay has focus).

from selenium import webdriver

URL = "https://lenta.com/goods-actions/weekly-products/"
driver = webdriver.Chrome()
driver.get(URL)
ans = driver.find_element_by_link_text("Санкт-Петербург") 
print(ans.get_attribute("class"))
#=> link current-store__link js-pick-city-toggle

Upvotes: 2

Related Questions