Quantcast
Viewing all articles
Browse latest Browse all 12201

Shadow DOM Selenium python

I want to get the contents of shadow_root, but selenium.common.exceptions.NoSuchShadowRootException is thrown: Message: no such shadow root

I want to get all the tags "ul.syncshare-cm"

enter image description here

The css selector "body > div:nth-last-child(2)" successfully finds the desired div tag (shadow-root inside it)When trying to get .shadow_root an exception is thrown selenium.common.exceptions.NoSuchShadowRootException: Message: no such shadow root

shadow_root = webdriver.find_element(By.CSS_SELECTOR, "body > div:nth-last-child(2)").shadow_root

shadow_tags = shadow_root.find_elements(By.CSS_SELECTOR, "ul.syncshare-cm")

print(shadow_tags)


Viewing all articles
Browse latest Browse all 12201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>