0

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

  • 1
    an [`iframe`](https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe) is there to embed another HTML page into the current page using its `src` attribute. Everything between the `` is only displayed if the browser does not support `iframe`. `html` is not a valid child of `iframe` [iframe: Content model](https://html.spec.whatwg.org/multipage/embedded-content.html#iframe-content-model) – t.niese Aug 12 '16 at 11:54
  • Hello, the browser I use is Mozilla Firefox. When I look at the code in the HTML page, I can see the tags (html, body) inside but I can not reach them. –  Aug 12 '16 at 12:06
  • In the source code it is still available, but in the DOM (the structure that is created out of the HTML code for rendering and that is used to access the individual elements), the `iframe` will only have one child node of the type `Text` with ` // I want to write here ` as `data`, this data is not parsed into DOMElements, so you can't query for them, you can only access the whole string. You for sure could parse this string manually into a DOM structure. But why do you store it at all in an `iframe` element? – t.niese Aug 12 '16 at 12:13
  • You're right, I could have done like this. The challenge was to fit Selenium IDE. I found a solution to my problem. Thank you. –  Aug 12 '16 at 12:56
  • If you found a solution then you should add it as answer to your question. – t.niese Aug 12 '16 at 12:57

1 Answers1

0

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