<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>
这个iframe没有id、没有name,请问怎么能切换到这个iframe呢?
已经尝试了:
iframe = browser.find_element_by_xpath('//*[@id="content-pannel"]/div/div[1]/iframe')
browser.switch_to.frame(iframe)
先定位到这个iframe,再切换,但是失败了,并报错:selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
你可以换个思路,先等页面加载完,然后获取页面中所有的iframe,通过标签(tags),然后再去找你想要的....