[Python] How do I get an element from shadow DOM in Selenium in Python?

Discussão em 'Python' iniciado por Stack, Novembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    could someone please explain to me how to get an element from shadow DOM in Selenium4 in Python? I want to element.click() to Accept the cookies - but I fail at the very first step!

    I've tried driver.find_element(By.CSS_SELECTOR, '#shadow_host') ... driver.find_element(By.CSS_SELECTOR, '#shadow_root')

    Every time "no such element: Unable to locate element".

    Bye

    Michael

    [​IMG]

    Continue reading...

Compartilhe esta Página