Selenium cannot switch iframe

<iframe sandbox="allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-same-origin allow-scripts allow-popups" allowfullscreen="true" name="{"hostOrigin":"https://im.******.com","containerId":1544627686619,"hostVersion":"3.7.2","language":"zh_CN"}" nwdisable="true" src="https://aflow.******.com/******/pc/query/pchomepage.htm?corpid=******" style="width: 100%; height: 100%; display: inline-block;" cd_frame_id_="ed8be806f350591e756b2762c4c8335e"></iframe>

how can I switch to this iframe without id or name,?
has tried:

iframe = browser.find_element_by_xpath("//*[@id="content-pannel"]/div/div[1]/iframe")
browser.switch_to.frame(iframe)

locate the iframe, before switching, but failed and reported an error: selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing "value"

Feb.22,2022

you can change your way of thinking, wait for the page to finish loading, then get all the iframe, on the page through the tag (tags), and then find what you want.


wait for the page to load, and then try
driver.switch_to.frame (driver.find_elements_by_tag_name ("iframe") [0])

.
Menu