I have a iframe inside shadow DOM element
<plugin-iframe class="plugin-iframe-class">
#shadow-root (closed)
<iframe title="Test" class="test-class">...</iframe>
</plugin-iframe>
I need to switch to iframe using selenium with python.
I have tried to fetch iframe directly using xpath, tagname and Accessing Shadow DOM tree with Selenium
I'm using the following code:
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--ignore-ssl-errors')
driver = webdriver.Chrome(executable_path="Drivers\\chromedriver.exe", options=options)
driver.maximize_window()
I have tried to switch frame using index it's working fine on firefox but not on chrome:
driver.switch_to.default_content()
driver.switch_to.frame(0)
The have tried to access shadow-root but it's also not working:
element = driver.find_element_by_tag_name("plugin-iframe")
shadow = driver.execute_script('return arguments[0].shadowRoot', ele)