[英]How to identify the document content which is created dynamically inside iframe
[英]How to identify IFrame dynamically in selenium using Java
我正在尝试自动化我的应用程序,并且在我的应用程序中 IFrame id 和名称正在动态更改,我无法唯一标识我的 Iframe。 这是我的 HTML Ifrmae 。在此 Iframe 名称正在动态更改中,目前,IFrame 名称为“tvcTabs0_c340contentFrame”,在此名称中,数字是动态更改的,我尝试使用 ID Name、Source、 contains、starts-with 关键字但我我无法唯一地制作。下一个 Iframe 是 tvcTabs0_c341contentFrame,我必须在存在嵌套 IFrame 的 Iframe 1 下进行。
请让我知道如何动态识别它..我也尝试过索引,但它不起作用。
我们可以通过以下 3 种方式处理 iFrame。
按索引
按名称或 ID
按网络元素
在您的情况下,ID 和 WebElement 属性是动态的,您可以使用该特定 iFrame 的索引。 iFrame 索引从 0 开始。
例如,如果您在网页中有 4 个 iFrame,并且您想切换到第 3 个 iFrame,那么代码片段将如下所示。
driver.switchTo().frame(2);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.