i would like to automate the following site: https://atlas.immobilienscout24.de/
using this code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import os
from webdriver_manager.chrome import ChromeDriverManager
if __name__ == '__main__':
print(f"Checking Browser driver...")
os.environ['WDM_LOG'] = '0'
options = Options()
options.add_argument("start-maximized")
options.add_experimental_option("prefs", {"profile.default_content_setting_values.notifications": 1})
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('excludeSwitches', ['enable-logging'])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument('--disable-blink-features=AutomationControlled')
srv=Service(ChromeDriverManager().install())
driver = webdriver.Chrome (service=srv, options=options)
waitWD = WebDriverWait (driver, 10)
link = f"https://atlas.immobilienscout24.de/"
driver.get (link)
driver.execute_script("arguments[0].click();", waitWD.until(EC.element_to_be_clickable((By.XPATH, '//button[@data-testid="uc-accept-all-button"]'))))
input("Press!")
When the site opens there allways appears this cookie-window and i am not able to press the accept button with the above code.
Instead i allways get this timeout-exception:
$ python test.py
Checking Browser driver...
Traceback (most recent call last):
File "G:\DEV\Fiverr\TRY\mapesix\test.py", line 26, in <module>
driver.execute_script("arguments[0].click();", waitWD.until(EC.element_to_be_clickable((By.XPATH, '//button[@data-testid="uc-accept-all-button"]'))))
File "G:\DEV\.venv\selenium\lib\site-packages\selenium\webdriver\support\wait.py", line 90, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Stacktrace:
Backtrace:
(No symbol) [0x00DB37D3]
(No symbol) [0x00D48B81]
(No symbol) [0x00C4B36D]
(No symbol) [0x00C7D382]
(No symbol) [0x00C7D4BB]
(No symbol) [0x00CB3302]
(No symbol) [0x00C9B464]
(No symbol) [0x00CB1215]
(No symbol) [0x00C9B216]
(No symbol) [0x00C70D97]
(No symbol) [0x00C7253D]
GetHandleVerifier [0x0102ABF2+2510930]
GetHandleVerifier [0x01058EC1+2700065]
GetHandleVerifier [0x0105C86C+2714828]
GetHandleVerifier [0x00E63480+645344]
(No symbol) [0x00D50FD2]
(No symbol) [0x00D56C68]
(No symbol) [0x00D56D4B]
(No symbol) [0x00D60D6B]
BaseThreadInitThunk [0x766500F9+25]
RtlGetAppContainerNamedObjectPath [0x77C27BBE+286]
RtlGetAppContainerNamedObjectPath [0x77C27B8E+238]
How can i close this cookie-window?