title: how to locate an element embedded in iframe for Python Selenium
body: <p>I am having problem locating a single report element embedded in iframe. There many reports contains in table where iframe is located.  Also using the firefox firePath it is given me a very link and am not sure how to remove the long strings. Edited the code: </p>
  
  <pre><code>    browser.switch_to_frame(browser.find_element_by_tag_name("iframe"))
      # set the context on the child frame
      browser.switch_to_frame(browser.find_element_by_id("__gwt_historyFrame"))
  
      # set the context on the next child frame
     wait = WebDriverWait(self.browser, 10)
          browser.switch_to_frame(wait.until(EC.presence_of_element_located(By.ID,"com.demandreports.wb.Workbench")))
  
      #click the link
      wait.until(EC.presence_of_element_located(By.LINK_TEXT,"Invoice Aging Report")).click()
  
      # switch back to the main document context
      browser.switch_to_default_content()
  </code></pre>
  
  <p>This is error:</p>
  
  <pre><code>    Traceback (most recent call last):
    File "C:\Python34\zuoraDataexport6.py", line 118, in &lt;module&gt;
      scraper.scrape()
    File "C:\Python34\zuoraDataexport6.py", line 57, in scrape
      browser.switch_to_frame(browser.find_element_by_id("com.demandreports.wb.Workbench"))
    File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 234, in find_element_by_id
      return self.find_element(by=By.ID, value=id_)
    File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 712, in find_element
      {'using': by, 'value': value})['value']
    File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 201, in execute
      self.error_handler.check_response(response)
    File "C:\Python34\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"id","selector":"com.demandreports.wb.Workbench"}
  </code></pre>
  
  <p>This is what i want to locate: 
      Invoice Aging Report</p>
  
  <p>This is the html:    </p>
  
  <pre><code>&lt;document&gt;
      &lt;html style="overflow: hidden;"&gt;
      &lt;head&gt;
      &lt;body style="margin: 0px;"&gt;
      &lt;iframe id="__gwt_historyFrame" style="position:absolute;width:0;height:0;border:0" tabindex="-1" src="javascript:''"/&gt;
      &lt;iframe id="com.demandreports.wb.Workbench" src="javascript:''" style="position: absolute; width: 0px; height: 0px; border: medium none;" tabindex="-1"/&gt;
      &lt;table class="Workbench-Page" cellspacing="0" cellpadding="0"&gt;
      &lt;tbody&gt;
      &lt;tr&gt;
      &lt;tr&gt;
      &lt;tr&gt;
      &lt;/tbody&gt;
      &lt;/table&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  &lt;/document&gt;
  </code></pre>