1

I am trying to click through all buttons of a certain type on a webpage and scrape the info from the resulting pop up boxes. The code I wrote so far works on the first 4 buttons and on the next I get the following error message:

ElementNotInteractableException: Message: element not interactable

Here is the code I wrote so far:

driver = webdriver.Chrome()

url = 'https://www.handyverkauf.net/macbook-verkaufen/macbook-pro'
    
time.sleep(3)
driver.get(url)
time.sleep(3)


buttons = driver.find_elements_by_xpath("//a[@class='uk-button uk-button-small uk-button-primary']//span[@class='uk-hidden-small'][contains(text(),'Zum Vergleich')]")

buttons[4].click()

The webpage is this: https://www.handyverkauf.net/macbook-verkaufen/macbook-pro

I have attached a screenshot here which shows the buttons I would like to click. The first 4 'Zum Vergleich' work fine (for the MacBook Pro 2021) but then the fifth (for the Macbook pro 2020) stops working.

jack93g
  • 23
  • 2
  • [Welcome to StackOverflow.](https://stackoverflow.com/tour) Do these help?: https://stackoverflow.com/questions/44119081/how-do-you-fix-the-element-not-interactable-exception, https://stackoverflow.com/questions/56194094/how-to-fix-this-issue-element-not-interactable-selenium-python, https://stackoverflow.com/questions/68858015/why-is-the-element-not-interactable-using-selenium-selenium-common-exceptions-e and https://www.google.com/search?q=element+not+interactable+python+selenium – The Amateur Coder May 19 '22 at 16:30
  • 1
    `buttons[4].click()` fails because the button is not visible in the page, but it is hidden. To unhide it you have first to click on the button "weitere Variationen (CTO-Modelle)" – sound wave May 19 '22 at 16:33
  • ok, thanks a lot. now i understand the problem :) – jack93g May 20 '22 at 07:27
  • Is it ok if I write my previous comment in an answer, so that you can accept it and the question is resolved? Let me know :) – sound wave May 21 '22 at 10:01
  • sure, no problem. – jack93g May 22 '22 at 12:14

0 Answers0