简体   繁体   English

如何使用Selenium IDE在iframe中编写

[英]How to write in iframe with Selenium IDE

I have an html page composed as follows: 我有一个组成如下的html页面:

<myDiv>
 <div>
  <Iframe>
   <Html>
    <Body>
     // I want to write here
    </ Body>
   </ Html>
  </ Iframe>
 </ div>
</ myDiv>

I manage to reach the iframe but I can not enter HTML tags and BODY. 我设法到达iframe,但无法输入HTML代码和正文。 I use Seleium IDE, after reading several topic on the subject, it still does not answer my question. 我使用Seleium IDE,在阅读了有关该主题的几个主题之后,它仍然无法回答我的问题。 I tried two commands with Selenium IDE, I think the first command works because I have no errors in the logs. 我用Selenium IDE尝试了两个命令,我认为第一个命令有效,因为日志中没有错误。 The second command does not work, I think it's not much but I need some help. 第二个命令不起作用,我认为它不多,但是我需要一些帮助。 Thank you. 谢谢。

command 1: 命令1:
command -> selectFrame 命令-> selectFrame
Target -> // div [@ id = 'myDiv'] / div / iframe / 目标-> // div [@ id ='myDiv'] / div / iframe /
value -> nothing 值->没有

command 2: 命令2:
command -> type 命令->类型
Target -> // htlm / body / 目标-> // htlm / body /
value -> my text 值->我的文字

I found a solution to my problem, the iframe is a JSF component 'editor' that is not accessible when the page is loaded. 我找到了解决问题的方法,iframe是一个JSF组件“编辑器”,在加载页面时无法访问它。 You have to play the following script which allows to access the component once it is loaded. 您必须播放以下脚本,该脚本允许在组件加载后对其进行访问。

<tr>
    <td>runScript</td>
    <td>document.getElementById('myComponent').style.display=&quot;block&quot;;</td>
    <td></td>
</tr>

// myComponent is the iframe id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM