Select Iframe inside other tags on Selenium
<p>Good day everyone.</p>

<p>First, here is a TL;DR version: </p>

<p>I need to select an element inside an iframe which is also inside many other HTML tags.</p>

<p>Now, the actual problem:</p>

<p>Today I`m trying to solve a little problem I have at work. Every day I need to perform a time-consuming task of filling a form with some information. The thing is that every form must be completed in the exactly same way and I have to do this on an individual web page. I learned about Selenium a few months back and tried to use it on the site so that I could automate this process.</p>

<p>The thing is that I ran into a problem. Apparently, Selenium IDE doesn't recognize iframes. I tried to export the code to Python 2.7 and edit it according to some stack overflow solutions I`ve found, but apparently, nothing works, probably because I'm new to this kind of thing.</p>

<p>The iframe is located inside of a bunch of other HTML tags( like table, spam, body, etc.i) soI have no idea on how to get to it.</p>

<p>Below is part of the webpage's code that contains the iframe and just after it is the test that I tried to automate using Python 2.7. Have in mind that I'm completely new to python and I've only used Selenium IDE once so far.</p>

<p>HTML code simplified by section:</p>

<pre><code>&lt;table class="dialog tabbed " id="tabDialog_6" cellspacing="0" cellpadding="0"&gt;

&lt;tbody&gt;


##A bunch of tables, spam, and bodies above.


&lt;iframe id="descrpt_ifr" src='javascript:""' frameborder="0" style="width: 100%; height: 126px;" tabindex="78"&gt;

&lt;/iframe&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="mceLast"&gt;&lt;td class="mceStatusbar mceFirst mceLast"&gt;
&lt;div id="descrpt_path_row"&gt;&amp;nbsp;&lt;a href="#" accesskey="x"&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;a id="descrpt_resize" href="javascript:;" onclick="return false;" class="mceResize"&gt;
&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/span&gt;
&lt;script&gt;var WYSIWYGdisplayed = Boolean(window.tinyMCE != null);
&lt;/script&gt;&amp;nbsp;&lt;table style="vertical-align: text-bottom; display: inline;" width="1%" cellpadding="0" cellspacing="0" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td nowrap="" style="border: none;"&gt;
&lt;a id="oylyLink" title="Spell Check" class="button" href="javascript: void spellCheck(document.regform.LADD)" tabindex="79" onfocus="document.getElementById('oyly').onmouseover();" onblur="document.getElementById('oyly').onmouseout();"&gt;
&lt;div id="oyly" class="button_off" onmousedown="mousedownButton('oyly');" onmouseup="highlightButton(false, 'oyly');" onmouseover="highlightButton(true, 'oyly');" onmouseout="highlightButton(false, 'oyly');" style=""&gt;
&lt;img src="/MRimg/spell_check.png" alt="Spell Check" border="0" align="absmiddle" id="oyly_image"&gt;
&lt;/div&gt;
&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class="descriptionSectionHeader"&gt;Complete Description (PUBLIC)
&lt;/div&gt;

&lt;div class="indented"&gt;&lt;iframe src="/tmp/alldesc_61121857.html" name="ALL_DESCS" width="702" height="170" scrolling="yes" wrap="hard"&gt;&lt;/iframe&gt;&lt;/div&gt;   
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>Entire html code of the page:</p>

<pre><code>&lt;table class="dialog tabbed " id="tabDialog_6" cellspacing="0" cellpadding="0"&gt;
    &lt;script language="javascript"&gt; tabIDs['Description'] = "tabDialog_6"; &lt;/script&gt; 
    &lt;tbody&gt;&lt;tr&gt;
       &lt;td class="dialogMainContent"&gt;
    &lt;div id="newDesc" class="descriptionSectionHeader"&gt;&lt;label id="LADD_label" for="descrpt" class=""&gt;Append New Description (PUBLIC)&lt;span class="asteriskHolder"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;/div&gt;&lt;div class="indented"&gt;
                    &lt;script language="JavaScript"&gt;

            function combineFields () {
                  var flds = new Array();
                  var res = new Array();
                  for (var i=0; i&lt; flds.length; i++) {
                     var fld = document.regform.elements[flds[i]];
                     if (fld != null)
                     {
                     if (fld.type == 'select-one' &amp;&amp; fld.selectedIndex&gt;=0 &amp;&amp; fld.options[fld.selectedIndex].value) {
                        res.push (fld.name+'='+fld.options[fld.selectedIndex].value);
                     } else if (fld.type == 'text'  &amp;&amp; fld.value) {
                        res.push (fld.name+'='+fld.value);
                     } else if (fld.type == 'select-multiple' &amp;&amp; fld.selectedIndex&gt;=0) {
                        var sel = new Array();
                        for (var j=0; j&lt; fld.options.length; j++) {
                            if (fld.options[j].selected &amp;&amp; fld.options[j].value) {
                                sel.push(fld.options[j].value);
                            }
                        }
                        if (sel.length&gt; 0){res.push (fld.name+'~'+sel.join('|'));}
                     } else if (fld.type == 'checkbox' &amp;&amp; fld.checked) {
                           res.push (fld.name+'='+fld.value);
                     } else if (fld.type == 'textarea' &amp;&amp; fld.value) {
                           res.push (fld.name+'~'+fld.value);
                     }
                   }
                   }
                   var ret = encodeURIComponent(res.join(','));
                   ret = '&amp;SOLFILTR=' + (ret || "__nothing__");
                   return ret;
           }


                     function searchsolutions() {
                       var height = 530;
                       var width = 660;
                       var str = combineFields();

                       window.open('/MRcgi/MRshowsolutions_page.pl?USER=UserPROJECTID=2&amp;MRP=5pIpUWj0&amp;REGPAGE=0&amp;SELECTSOLUTION=1&amp;SESS_ID=9c91e9288993272a387fbe9f9f7c0fac&amp;SAVEDNAME=SOL'+str, 'solsearch', 'top=176,left=133,width=' + width + ',height=' + height + ',status=yes,toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes');
                    }
                    &lt;/script&gt;
                &lt;table class="inlineDialogHeading indented"&gt;
    &lt;tbody&gt;&lt;tr&gt;
    &lt;td&gt;&lt;table style="vertical-align: text-bottom; display: inline;" width="1%" cellpadding="0" cellspacing="0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td nowrap="" style="border: none;"&gt;&lt;a id="searchKBButtonLink" title="Search Knowledge Base" class="button" href="javascript:searchsolutions();" tabindex="77" onfocus="document.getElementById('searchKBButton').onmouseover();" onblur="document.getElementById('searchKBButton').onmouseout();"&gt;&lt;div id="searchKBButton" class="button_off" onmousedown="mousedownButton('searchKBButton');" onmouseup="highlightButton(false, 'searchKBButton');" onmouseover="highlightButton(true, 'searchKBButton');" onmouseout="highlightButton(false, 'searchKBButton');" style=""&gt;&lt;img src="/MRimg/knowledge_base.png" alt="Search Knowledge Base" border="0" align="absmiddle" id="searchKBButton_image"&gt; &lt;span id="searchKBButton_textSpan" style=" height: 18px; cursor: pointer;"&gt;Search Knowledge Base&lt;/span&gt;&lt;/div&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
    &lt;textarea name="LADD" title="Description (PUBLIC)" cols="85" id="descrpt" tabindex="-1" onkeypress="addAutoSpell(document.regform.LADD)" style="height: 170px; width: 702px; display: none;" class="wysiwyg"&gt;&lt;/textarea&gt;&lt;span id="descrpt_parent" class="mceEditor defaultSkin"&gt;&lt;table id="descrpt_tbl" class="mceLayout" cellspacing="0" cellpadding="0" style="width: 702px; height: 170px;"&gt;&lt;tbody&gt;&lt;tr class="mceFirst"&gt;&lt;td class="mceToolbar mceLeft mceFirst mceLast"&gt;&lt;a href="#" accesskey="q" title="Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X"&gt;&lt;!-- IE --&gt;&lt;/a&gt;&lt;table id="descrpt_toolbar1" class="mceToolbar mceToolbarRow1 Enabled" cellpadding="0" cellspacing="0" align=""&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="mceToolbarStart mceToolbarStartButton mceFirst"&gt;&lt;span&gt;&lt;!-- IE --&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_newdocument" href="javascript:;" class="mceButton mceButtonEnabled mce_newdocument" onmousedown="return false;" onclick="return false;" title="New document"&gt;&lt;span class="mceIcon mce_newdocument"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;span class="mceSeparator"&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_cut" href="javascript:;" class="mceButton mceButtonEnabled mce_cut" onmousedown="return false;" onclick="return false;" title="Cut"&gt;&lt;span class="mceIcon mce_cut"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_copy" href="javascript:;" class="mceButton mceButtonEnabled mce_copy" onmousedown="return false;" onclick="return false;" title="Copy"&gt;&lt;span class="mceIcon mce_copy"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_paste" href="javascript:;" class="mceButton mceButtonEnabled mce_paste" onmousedown="return false;" onclick="return false;" title="Paste"&gt;&lt;span class="mceIcon mce_paste"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_undo" href="javascript:;" class="mceButton mce_undo mceButtonEnabled" onmousedown="return false;" onclick="return false;" title="Undo (Ctrl+Z)"&gt;&lt;span class="mceIcon mce_undo"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_redo" href="javascript:;" class="mceButton mce_redo mceButtonDisabled" onmousedown="return false;" onclick="return false;" title="Redo (Ctrl+Y)"&gt;&lt;span class="mceIcon mce_redo"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;span class="mceSeparator"&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;table id="descrpt_fontselect" cellpadding="0" cellspacing="0" class="mceListBox mceListBoxEnabled mce_fontselect"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="mceFirst"&gt;&lt;a id="descrpt_fontselect_text" href="javascript:;" class="mceText mceTitle" onclick="return false;" onmousedown="return false;"&gt;Font family&lt;/a&gt;&lt;/td&gt;&lt;td class="mceLast"&gt;&lt;a id="descrpt_fontselect_open" tabindex="-1" href="javascript:;" class="mceOpen" onclick="return false;" onmousedown="return false;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;td&gt;&lt;table id="descrpt_fontsizeselect" cellpadding="0" cellspacing="0" class="mceListBox mceListBoxEnabled mce_fontsizeselect"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="mceFirst"&gt;&lt;a id="descrpt_fontsizeselect_text" href="javascript:;" class="mceText mceTitle" onclick="return false;" onmousedown="return false;"&gt;Font size&lt;/a&gt;&lt;/td&gt;&lt;td class="mceLast"&gt;&lt;a id="descrpt_fontsizeselect_open" tabindex="-1" href="javascript:;" class="mceOpen" onclick="return false;" onmousedown="return false;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;td&gt;&lt;span class="mceSeparator"&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;table id="descrpt_forecolor" class="mceSplitButton mceSplitButtonEnabled mce_forecolor" cellpadding="0" cellspacing="0" onmousedown="return false;" title="Select text color"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="mceFirst"&gt;&lt;a id="descrpt_forecolor_action" href="javascript:;" class="mceAction mce_forecolor" onclick="return false;" onmousedown="return false;" title="Select text color"&gt;&lt;span class="mceAction mce_forecolor"&gt;&lt;/span&gt;&lt;div id="descrpt_forecolor_preview" class="mceColorPreview" style="background-color: rgb(136, 136, 136);"&gt;&lt;/div&gt;&lt;/a&gt;&lt;/td&gt;&lt;td class="mceLast"&gt;&lt;a id="descrpt_forecolor_open" href="javascript:;" class="mceOpen mce_forecolor" onclick="return false;" onmousedown="return false;" title="Select text color"&gt;&lt;span class="mceOpen mce_forecolor"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;td&gt;&lt;table id="descrpt_backcolor" class="mceSplitButton mceSplitButtonEnabled mce_backcolor" cellpadding="0" cellspacing="0" onmousedown="return false;" title="Select background color"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="mceFirst"&gt;&lt;a id="descrpt_backcolor_action" href="javascript:;" class="mceAction mce_backcolor" onclick="return false;" onmousedown="return false;" title="Select background color"&gt;&lt;span class="mceAction mce_backcolor"&gt;&lt;/span&gt;&lt;div id="descrpt_backcolor_preview" class="mceColorPreview" style="background-color: rgb(136, 136, 136);"&gt;&lt;/div&gt;&lt;/a&gt;&lt;/td&gt;&lt;td class="mceLast"&gt;&lt;a id="descrpt_backcolor_open" href="javascript:;" class="mceOpen mce_backcolor" onclick="return false;" onmousedown="return false;" title="Select background color"&gt;&lt;span class="mceOpen mce_backcolor"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;td&gt;&lt;span class="mceSeparator"&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_bold" href="javascript:;" class="mceButton mceButtonEnabled mce_bold" onmousedown="return false;" onclick="return false;" title="Bold (Ctrl+B)"&gt;&lt;span class="mceIcon mce_bold"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_italic" href="javascript:;" class="mceButton mceButtonEnabled mce_italic" onmousedown="return false;" onclick="return false;" title="Italic (Ctrl+I)"&gt;&lt;span class="mceIcon mce_italic"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_underline" href="javascript:;" class="mceButton mceButtonEnabled mce_underline" onmousedown="return false;" onclick="return false;" title="Underline (Ctrl+U)"&gt;&lt;span class="mceIcon mce_underline"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;span class="mceSeparator"&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_justifyleft" href="javascript:;" class="mceButton mceButtonEnabled mce_justifyleft" onmousedown="return false;" onclick="return false;" title="Align left"&gt;&lt;span class="mceIcon mce_justifyleft"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_justifycenter" href="javascript:;" class="mceButton mceButtonEnabled mce_justifycenter" onmousedown="return false;" onclick="return false;" title="Align center"&gt;&lt;span class="mceIcon mce_justifycenter"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_justifyright" href="javascript:;" class="mceButton mceButtonEnabled mce_justifyright" onmousedown="return false;" onclick="return false;" title="Align right"&gt;&lt;span class="mceIcon mce_justifyright"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_justifyfull" href="javascript:;" class="mceButton mceButtonEnabled mce_justifyfull" onmousedown="return false;" onclick="return false;" title="Align full"&gt;&lt;span class="mceIcon mce_justifyfull"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;span class="mceSeparator"&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_bullist" href="javascript:;" class="mceButton mceButtonEnabled mce_bullist" onmousedown="return false;" onclick="return false;" title="Unordered list"&gt;&lt;span class="mceIcon mce_bullist"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_numlist" href="javascript:;" class="mceButton mceButtonEnabled mce_numlist" onmousedown="return false;" onclick="return false;" title="Ordered list"&gt;&lt;span class="mceIcon mce_numlist"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;span class="mceSeparator"&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_outdent" href="javascript:;" class="mceButton mce_outdent mceButtonDisabled" onmousedown="return false;" onclick="return false;" title="Outdent"&gt;&lt;span class="mceIcon mce_outdent"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_indent" href="javascript:;" class="mceButton mceButtonEnabled mce_indent" onmousedown="return false;" onclick="return false;" title="Indent"&gt;&lt;span class="mceIcon mce_indent"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;span class="mceSeparator"&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_table" href="javascript:;" class="mceButton mceButtonEnabled mce_table" onmousedown="return false;" onclick="return false;" title="Inserts a new table"&gt;&lt;span class="mceIcon mce_table"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_hr" href="javascript:;" class="mceButton mceButtonEnabled mce_hr" onmousedown="return false;" onclick="return false;" title="Insert horizontal ruler"&gt;&lt;span class="mceIcon mce_hr"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_charmap" href="javascript:;" class="mceButton mceButtonEnabled mce_charmap" onmousedown="return false;" onclick="return false;" title="Insert custom character"&gt;&lt;span class="mceIcon mce_charmap"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_link" href="javascript:;" class="mceButton mce_link mceButtonEnabled" onmousedown="return false;" onclick="return false;" title="Insert/edit link"&gt;&lt;span class="mceIcon mce_link"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;a id="descrpt_image" href="javascript:;" class="mceButton mceButtonEnabled mce_image" onmousedown="return false;" onclick="return false;" title="Insert/edit image"&gt;&lt;span class="mceIcon mce_image"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;td class="mceToolbarEnd mceToolbarEndButton mceLast"&gt;&lt;span&gt;&lt;!-- IE --&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;a href="#" accesskey="z" title="Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X" onfocus="tinyMCE.getInstanceById('descrpt').focus();"&gt;&lt;!-- IE --&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="mceIframeContainer mceFirst mceLast"&gt;


##THE IFRAME IS RIGHT IN THIS SECTION



&lt;iframe id="descrpt_ifr" src='javascript:""' frameborder="0" style="width: 100%; height: 126px;" tabindex="78"&gt;

&lt;/iframe&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="mceLast"&gt;&lt;td class="mceStatusbar mceFirst mceLast"&gt;
&lt;div id="descrpt_path_row"&gt;&amp;nbsp;&lt;a href="#" accesskey="x"&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;a id="descrpt_resize" href="javascript:;" onclick="return false;" class="mceResize"&gt;
&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/span&gt;
&lt;script&gt;var WYSIWYGdisplayed = Boolean(window.tinyMCE != null);
&lt;/script&gt;&amp;nbsp;&lt;table style="vertical-align: text-bottom; display: inline;" width="1%" cellpadding="0" cellspacing="0" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td nowrap="" style="border: none;"&gt;
&lt;a id="oylyLink" title="Spell Check" class="button" href="javascript: void spellCheck(document.regform.LADD)" tabindex="79" onfocus="document.getElementById('oyly').onmouseover();" onblur="document.getElementById('oyly').onmouseout();"&gt;
&lt;div id="oyly" class="button_off" onmousedown="mousedownButton('oyly');" onmouseup="highlightButton(false, 'oyly');" onmouseover="highlightButton(true, 'oyly');" onmouseout="highlightButton(false, 'oyly');" style=""&gt;
&lt;img src="/MRimg/spell_check.png" alt="Spell Check" border="0" align="absmiddle" id="oyly_image"&gt;
&lt;/div&gt;
&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class="descriptionSectionHeader"&gt;Complete Description (PUBLIC)
&lt;/div&gt;

&lt;div class="indented"&gt;&lt;iframe src="/tmp/alldesc_61121857.html" name="ALL_DESCS" width="702" height="170" scrolling="yes" wrap="hard"&gt;&lt;/iframe&gt;&lt;/div&gt;   
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>My Selenium IDE code exported to python.</p>

<pre><code># -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re

class CasoDeTesteStiMEmPython(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
        self.driver.implicitly_wait(30)
        self.base_url = "THE WEBPAGE I NEED TO FILL THE FORM"
        self.verificationErrors = []
        self.accept_next_alert = True

    def test_caso_de_teste_sti_m_em_python(self):
        driver = self.driver
        driver.get(self.base_url + "/MRcgi/MRhomepage.pl?USER=yferreir&amp;PROJECTID=3&amp;MRP=bmKXVpJkDK&amp;OPTION=none&amp;WRITECACHE=1&amp;FIRST_TIME_IN_FP=1&amp;FIRST_TIME_IN_PROJ=1&amp;REMEMBER_SCREEN=1&amp;")
        driver.find_element_by_id("SEARCHS").clear()
        driver.find_element_by_id("SEARCHS").send_keys("404905")
        driver.find_element_by_id("splitbutton1-button").click()
        # ERROR: Caught exception [ERROR: Unsupported command [waitForPopUp | details404905 | 100000]]
        # ERROR: Caught exception [ERROR: Unsupported command [selectWindow | name=details404905 | ]]
        driver.find_element_by_id("editButton_image").click()
        Select(driver.find_element_by_id("status")).select_by_visible_text("Under Investigation")
         ##RIGHT HERE IS WHERE I NEED TO SELECT THE IFRAME
         ##THE FOLLOWING PARTS OF THE CODE WITH ## ARE FROM A STACKOVERFLOW SOLUTION I TRIED


        ## Give time for iframe to load ##
        time.sleep(3)
        ## You have to switch to the iframe like so: ##
        driver.switch_to_frame(driver.find_element_by_tag_name("descrpt_ifr"))
        ## Insert text via xpath ##
        elem = driver.find_element_by_xpath("//*[@id="tinymce"]/p")
        elem.send_keys("WHAT I NEED TO WRITE IN THE ELEMENT INSIDE THE IFRAME")
        ## Switch back to the "default content" (that is, out of the iframes) ##
        driver.switch_to_default_content()
        # ERROR: Caught exception [ERROR: Unsupported command [selectWindow | name=details404905 | ]]
        driver.find_element_by_id("goButton_textSpan").click()
        # ERROR: Caught exception [ERROR: Unsupported command [selectWindow | null | ]]
        driver.find_element_by_id("SEARCHS").clear()
        driver.find_element_by_id("SEARCHS").send_keys("404905")
        driver.find_element_by_id("splitbutton1-button").click()
        # ERROR: Caught exception [ERROR: Unsupported command [waitForPopUp | details404905 | 100000]]
        # ERROR: Caught exception [ERROR: Unsupported command [selectWindow | name=details404905 | ]]
        driver.find_element_by_id("editButton_textSpan").click()
        Select(driver.find_element_by_id("status")).select_by_visible_text("Solved")
        driver.find_element_by_id("tab_1").click()
        Select(driver.find_element_by_id("userfield22")).select_by_visible_text("Administration")
        driver.find_element_by_id("userfield24").clear()
        driver.find_element_by_id("userfield24").send_keys("Cancelamento realizado com sucesso.")
        driver.find_element_by_id("goButton_textSpan").click()

    def is_element_present(self, how, what):
        try: self.driver.find_element(by=how, value=what)
        except NoSuchElementException as e: return False
        return True

    def is_alert_present(self):
        try: self.driver.switch_to_alert()
        except NoAlertPresentException as e: return False
        return True

    def close_alert_and_get_its_text(self):
        try:
            alert = self.driver.switch_to_alert()
            alert_text = alert.text
            if self.accept_next_alert:
                alert.accept()
            else:
                alert.dismiss()
            return alert_text
        finally: self.accept_next_alert = True

    def tearDown(self):
        self.driver.quit()
        self.assertEqual([], self.verificationErrors)

if __name__ == "__main__":
    unittest.main()
</code></pre>

<p>I've tryed using the iframe's ID "descrpt_ifr" and the folloing Xpaths:</p>

<p>Iframe Xpath: //*[@id="descrpt_ifr"].</p>

<p>Element inside Iframe i want to use Xpath: //*[@id="tinymce"]/p.</p>

<p>Looks like the line of code used to switch to the iframe is causing the error</p>

<pre><code>driver.switch_to_frame(driver.find_element_by_tag_name("descrpt_ifr"))
</code></pre>

<p>'descrpt_ifr' is not a tag name. Change it to </p>

<pre><code>driver.switch_to_frame(driver.find_element_by_id("descrpt_ifr"))
</code></pre>

<p>Or use xpath to identify the iframe in case there are multiple matching nodes for the id. </p>

python html selenium iframe xpath