如何遍历iFrame中的不同帧? [英] How to traverse through different frames inside an iFrame?

查看:112
本文介绍了如何遍历iFrame中的不同帧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下面给出的iframe,我可以遍历iframe,但不能执行任何操作,如遍历或点击框架集内的其他组件或框架。
如何点击框架集内的框架/元素?

I have a iframe given below, I can traverse to iframe, but can't perform any operations like traverse or click on other components or frames inside the frameset. How do I click the frames/elements inside the frameset?

<iframe id="selector_window" name="selector_window" src="/webadmin/webeditor/selectormanager_wcm.jsp? width="750" height="450">
<html><head>
<meta http-equiv="pragma" content="no-cache">
</head>
<frameset rows="*,100" border="1" bordercolor="Gray">
    <frameset cols="200,200,200" border="1" bordercolor="Gray">
        <frame name="selectorlistfilter" src="blank.html" frameborder="1">
        <frame name="selectorlist" src="blank.html" frameborder="1">
        <frame name="selectorpreview" src="blank.html" frameborder="1">
    </frameset>
    <frame name="selectorinsert" src="blank.html" marginwidth="2" marginheight="2" frameborder="0">
</frameset>
</html>
</iframe>         


推荐答案

切换h到任何框架元素,只需使用 driver.switchTo()。frame(framename);

switch to any frame element , just use driver.switchTo().frame("framename");

一次我们切换到一帧,如果我们需要切换到另一帧,我们必须切换到父帧。为此使用

Once we switched to one frame, if we need to switch to another frame, we have to switch to the parent frame.For that use

driver.switchTo().parentFrame();

如果使用 driver.switchTo()。defaultContent(); ,它可能无效。
所以去 driver.switchTo()。parentFrame(); ,它工作正常。

If you use driver.switchTo().defaultContent();, it may not work. so go for driver.switchTo().parentFrame();, it works fine.

这篇关于如何遍历iFrame中的不同帧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆