Python Selenium webdriver working with iframes
<p>Good day. Im trying to learn how to use the Selenium IDE on firefox together with Python by exporting whatever test i did to Python 2.7.</p>

<p>During my test i ran into a few problems, one of them is that it isn't recognizing 2 text fields, which are inside iframes. Ive found some other answers right here on stack overflow but Im not really sure on how to apply them on my code. This is what i got from exporting directly from the Selenium IDE on firefox. I`m also completely new to python and programming in general, so any suggestion would also be welcome.</p>

<p>This is what i have right now:</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 StiMPythonWebdriver(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
        self.driver.implicitly_wait(30)
        self.base_url = "https://webpage.com/"
        self.verificationErrors = []
        self.accept_next_alert = True

    def test_sti_m_python_webdriver(self):
        driver = self.driver
        driver.find_element_by_id("SEARCHS").clear()
        driver.find_element_by_id("SEARCHS").send_keys("403627") **It inserts a code of a form**
        driver.find_element_by_id("splitbutton1-button").click()
        # ERROR: Caught exception [ERROR: Unsupported command [waitForPopUp | details403627 | 100000]]
        # ERROR: Caught exception [ERROR: Unsupported command [selectWindow | name=details403627 | ]] **It waits a little for the pop up window to open so it can continue the test**
        driver.find_element_by_id("editButton_textSpan").click()
        Select(driver.find_element_by_id("status")).select_by_visible_text("Option 1")
        # ERROR: Caught exception [ERROR: Unsupported command [selectFrame | id=descrpt_ifr | ]]
        # ERROR: Caught exception [ERROR: Unsupported command [selectFrame | id=tinymce | ]] **Right here at this part it is supposed to select the &lt;p&gt; inside the Iframe and type the following sentence "Canceled"**


        driver.find_element_by_id("descrpt_ifr").clear()
        driver.find_element_by_id("descrpt_ifr").send_keys("Canceled")
        # ERROR: Caught exception [ERROR: Unsupported command [selectWindow | name=details403627 | ]]
        driver.find_element_by_id("goButton_textSpan").click()**then it selects a button that exits the pop up**
</code></pre>

<p>If you want to switch to iframe</p>

<pre><code>driver.switch_to_frame(driver.find_element_by_xpath("//iframe[@id='tinymce ']"))
</code></pre>

<p>If you want to switch to window -1 seems default active window</p>

<pre><code>driver.switch_to_window(driver.window_handles[-1])
</code></pre>

<p>Don't forgot to switch back when you complete .</p>

python selenium iframe