I am trying to scrape the following website: https://www.nemlig.com/ but it is not as easy as I was used to, as the page I am trying to scrape things off is not static. What I am trying to do using Selenium is click this:
So that the zipcode pop-up is visible. Then, insert a number and hit enter.
This is my take on it:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
browser = webdriver.Chrome(executable_path=r"C:\Users\user\lib\chromedriver_77.0.3865.40.exe")
browser.get('https://www.nemlig.com/')
elem = browser.find_element_by_xpath("//div[@class='timeslot-statusbutton']")
elem.clear()
elem = browser.find_element_by_xpath("//input[@class='prompt__input ng-pristine ng-valid ng-empty ng-touched']")
elem.send_keys("2300")
elem.send_keys(Keys.RETURN)
But everything after browser.get returns me this error:
Traceback (most recent call last):
File "", line 8, in elem = browser.find_element_by_xpath("//div[@class='timeslot-statusbutton']").click()
File "D:\Anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click self._execute(Command.CLICK_ELEMENT)
File "D:\Anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute return self._parent.execute(command, params)
File "D:\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response)
File "D:\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace)
ElementNotInteractableException: element not interactable (Session info: chrome=77.0.3865.90)
How can I do this properly?

span[@class='timeslot-statusbutton__text']and I am getting the same error. - Questiemeelem.clear()thing out eventually. Replaced it withbrowser.execute_script("arguments[0].click();", elem). Thanks for the tip about the pop-up! However,elem.send_keys("2300")is nownot interactable. What do you think that is going wrong now? - Questieme