shadow_root context and use CSS selectors:# 1. Locate the shadow host element:
shadow_host = driver.find_element(By.CSS_SELECTOR, "custom-search-widget")# 2. Access shadow_root (Selenium 4 feature):
shadow_root = shadow_host.shadow_root
# 3. Locate elements inside the shadow root using CSS:
input_elem = shadow_root.find_element(By.CSS_SELECTOR, "input.search-field")
input_elem.send_keys("Python Test Automation")