title: Switch to correct iframe?
body: <p>In Visual Studio, using Selenium, I'm trying to click on a element that's inside a iframe.
  The code:
  <a href="https://i.stack.imgur.com/jtj6P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jtj6P.png" alt="enter image description here"></a></p>
  
  <p>The problem is i get an error if I use <code>ECMMyChangeActions</code> like this:</p>
  
  <pre><code>driver.SwitchTo().Frame("ECMMyChangeActions");
  </code></pre>
  
  <p>Error:
  <code>Message: OpenQA.Selenium.NoSuchFrameException : No frame element found with name or id ECMMyChangeActions</code></p>
  
  <p>Using Selenium IDE I have recorded this testcase and confirmed that a change of iframe is needed before clicking on any element inside this iframe.
  <a href="https://i.stack.imgur.com/5Xcai.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Xcai.png" alt="enter image description here"></a></p>
  
  <p>Using <code>driver.SwitchTo().Frame(0);</code> works in Visual Studio but I can still not find any element inside it. So I'm suspecting that iframe index=0 is incorrect.</p>
  
  <p>I have tried figuring out which iframe to use by counting all iframes on the page in this for-loop:</p>
  
  <pre><code>[Test]
          public void CountIframes()
          {
              int size = driver.FindElements(By.TagName("iframe")).Count();
  
              for (int i = 0; i &lt;= size; i++)
              {
                  driver.SwitchTo().Frame(i);
                  int total = driver.FindElements(By.XPath("//td[contains(@title,'Find...')]")).Count();
                  Console.Write(total);
                  driver.SwitchTo().DefaultContent();
              }
          }
  </code></pre>
  
  <p>The output I get using this for-loop is: 000. As I understand this for-loop code, it will only generate a "1" if the element I specified is found inside any of the iframes. So <code>000</code> would mean that no such element is found in any of the iframes.</p>
  
  <p>This is a picture of the HTML for that iframe: 
  <a href="https://i.stack.imgur.com/Ie2vp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ie2vp.png" alt="enter image description here"></a></p>
  
  <p>Please help me find the correct iframe.</p>