I am aiming to use my raspberry pi to test a webpage with python/selenium. The code works well on my desktop but the raspberry fail to handle the pop up:
driver = webdriver.Chrome()
driver.get("https://www.swoodoo.ch")
wait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//div[@aria-label='Schliessen']"))).click()
No problem on the desktop (ubuntu 22.04 or linux mint) On the raspberry (raspberian or ubuntu 22.04) I get a timeout exception:
Traceback (most recent call last):
File "/home/user/flights/flights2.py", line 19, in <module>
wait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//div[@aria-label='Schliessen']"))).click()
File "/home/user/.local/lib/python3.9/site-packages/selenium/webdriver/support/wait.py", line 95, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
I tried the following (all below works well on the desktop!):
a) I manually click the banner away -> the whole program fine, incl. the functions to grad text out of a search result. However, it is not automated
b) I added waiting time (
time.sleep(x))
between all lines, long waiting time (30+) -> no change
c) I changed the code to the following:
driver = webdriver.Chrome()
driver.get("https://www.swoodoo.ch")
time.sleep(5)
element=driver.find_element(By.XPATH, "//div[@aria-label='Schliessen']")
time.sleep(5)
element.click()
-> The computer finds the Element but it is not clickable, error code:
Traceback (most recent call last):
File "/home/user/flights/flights2.py", line 23, in <module>
element.click()
File "/home/user/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 93, in click
self._execute(Command.CLICK_ELEMENT)
File "/home/user/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 401, in _execute
return self._parent.execute(command, params)
File "/home/user/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
self.error_handler.check_response(response)
File "/home/user/.local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=104.0.5112.105)
Stacktrace:
#0 0x00557fda2268 <unknown>
#1 0x00557fbcbb08 <unknown>
#2 0x00557fbfd50c <unknown>
#3 0x00557fbf32d0 <unknown>
#4 0x00557fbf2cac <unknown>
#5 0x00557fc264c8 <unknown>
#6 0x00557fbf18f0 <unknown>
#7 0x00557fde52f4 <unknown>
#8 0x00557fde7b9c <unknown>
#9 0x00557fdd1cd4 <unknown>
#10 0x00557fde83bc <unknown>
#11 0x00557fdc6d64 <unknown>
#12 0x00557fe01cd0 <unknown>
#13 0x00557fe01e40 <unknown>
#14 0x00557fe1a6f0 <unknown>
d) Last idea was to use javascript for the click
driver.execute_script("arguments[0].click();", element)
-> No error message, no action
Anyone any ideas?