通过 Selenium 和 python 切换到 iframe [英] Switch to an iframe through Selenium and python

查看:23
本文介绍了通过 Selenium 和 python 切换到 iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何只知道在 selenium 中切换到这个 iframe

How would I switch to this iframe in selenium knowing only

<iframe name="Dialogue Window">

推荐答案

您可以使用 XPath 来定位 <iframe>:

You can use an XPath to locate the <iframe>:

iframe = driver.find_element_by_xpath("//iframe[@name='Dialogue Window']")

然后switch_to