antk43
antk43

Reputation: 1

Selenium IDE iframe

I am attempting to select an iframe and enter some text using Selenium IDE 2.8.0. I have tried a number of different approaches after having searched around a bit.

Using the script only command does enter the text into the field but, as many posts online have stated, this does not then work when used as a step within a test case:

tinymce.activeEditor.setContent('Test Text') 

I have tried to select the iframe using the id - selectFrame - followed by a combination of focus and click commands in a similar way as the following:

<tr>
<td>selectFrame</td>
<td>edit-body-und-0-value_ifr</td>
<td></td>
</tr>
<tr>
<td>focus</td>
<td>//body[@id='tinymce']/p</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//body[@id='tinymce']/p</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//body[@id='tinymce']/p</td>
<td>yellow</td>
</tr>

After executing the type command there is no text entered.

The HTML for the frame is as follows:

<tr>
<td class="mceIframeContainer mceFirst mceLast">
<iframe id="edit-body-und-0-value_ifr" frameborder="0" src="javascript:""" allowtransparency="true" title="Rich Text AreaPress ALT-F10 for toolbar. Press ALT-0 for help" style="width: 100%; height: 100px; display: block;">
<!DOCTYPE >
<html>
<head xmlns="http://www.w3.org/1999/xhtml">
<body id="tinymce" class="mceContentBody " contenteditable="true" onload="window.parent.tinyMCE.get('edit-body-und-0-value').onLoad.dispatch();" spellcheck="false" dir="ltr">
<p>
</body>
</html>
</iframe>
</td>
</tr>

Upvotes: 0

Views: 1290

Answers (1)

bcar
bcar

Reputation: 815

driver.switchTo().frame("I'd of iframe")
//do work
driver.switchTo().defaultContent() //switch back

Upvotes: 0

Related Questions