如何使用 Selenium 在 iframe 中编写 IDE
How to write in iframe with Selenium IDE
我有一个 html 页面组成如下:
<myDiv>
<div>
<Iframe>
<Html>
<Body>
// I want to write here
</ Body>
</ Html>
</ Iframe>
</ div>
</ myDiv>
我成功访问了 iframe,但无法输入 HTML 标记和 BODY。
我使用 Seleium IDE,在阅读了有关该主题的几个主题后,它仍然没有回答我的问题。
我用 Selenium IDE 尝试了两个命令,我认为第一个命令有效,因为我在日志中没有错误。第二个命令不起作用,我认为它不多,但我需要一些帮助。谢谢。
命令 1:
命令 -> selectFrame
目标 -> // div [@id = 'myDiv'] / div / iframe /
值 -> 无
命令 2:
命令 -> 类型
目标 -> // html / 正文 /
值 -> 我的文字
我找到了问题的解决方案,iframe 是一个 JSF 组件 'editor',在加载页面时无法访问。
您必须播放以下脚本,它允许在组件加载后访问它。
<tr>
<td>runScript</td>
<td>document.getElementById('myComponent').style.display="block";</td>
<td></td>
</tr>
// myComponent is the iframe id
我有一个 html 页面组成如下:
<myDiv>
<div>
<Iframe>
<Html>
<Body>
// I want to write here
</ Body>
</ Html>
</ Iframe>
</ div>
</ myDiv>
我成功访问了 iframe,但无法输入 HTML 标记和 BODY。 我使用 Seleium IDE,在阅读了有关该主题的几个主题后,它仍然没有回答我的问题。 我用 Selenium IDE 尝试了两个命令,我认为第一个命令有效,因为我在日志中没有错误。第二个命令不起作用,我认为它不多,但我需要一些帮助。谢谢。
命令 1:
命令 -> selectFrame
目标 -> // div [@id = 'myDiv'] / div / iframe /
值 -> 无
命令 2:
命令 -> 类型
目标 -> // html / 正文 /
值 -> 我的文字
我找到了问题的解决方案,iframe 是一个 JSF 组件 'editor',在加载页面时无法访问。 您必须播放以下脚本,它允许在组件加载后访问它。
<tr>
<td>runScript</td>
<td>document.getElementById('myComponent').style.display="block";</td>
<td></td>
</tr>
// myComponent is the iframe id