简体   繁体   中英

How to write in iframe with Selenium IDE

I have an html page composed as follows:

<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. I use Seleium IDE, after reading several topic on the subject, it still does not answer my question. I tried two commands with Selenium IDE, I think the first command works because I have no errors in the logs. The second command does not work, I think it's not much but I need some help. Thank you.

command 1:
command -> selectFrame
Target -> // div [@ id = 'myDiv'] / div / iframe /
value -> nothing

command 2:
command -> type
Target -> // 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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