seleniumgoogle-chromeselenium-chromedriverweb-testing

Why is a special cookie-banner not displayed in the Selenium-chromedriver test software?


For a web-test i call an online-shop which uses a special GDPR-cookie-banner. When I call this online store in a normal chrome browser, it is loaded and displayed.

However, when I call this online store with the test software (chromedriver, Selenium, Python), it is loaded but not displayed.

What is the reason and what can I do to display this banner?

Online-shop: https://www.uwaldu.de/

Browser snapshot with normal chrome browser:

enter image description here

Browser snapshot with webdriver:

enter image description here


Solution

  • Not sure why you won't see the special GDPR-cookie-banner. But when I access the website using a Selenium driven ChromeDriver initiated Browsing Context the GDPR-cookie-banner is displayed perfectly everytime.

    Code Block:

    options = Options()
    options.add_argument("start-maximized")
    options.add_experimental_option("excludeSwitches", ["enable-automation"])
    options.add_experimental_option('useAutomationExtension', False)
    options.add_argument('--disable-blink-features=AutomationControlled')
    s = Service('C:\\BrowserDrivers\\chromedriver.exe')
    driver = webdriver.Chrome(service=s, options=options)
    driver.get("https://uwaldu.de/")
    

    Browser Snapshot:

    GDPR