title: Multiple iframe tags Selenium webdriver
body: <p>I am trying to use selenium to send credit card info onto a site, and each element is contained in a separate iframe tag in the HTML. For example, the box to enter a credit card number is contained in the first iframe tag, and the card holder name is contained in the second iframe, and so on, and so forth. I am able to access the first iframe tag, and send the credit card number into the box, however I an unable to locate the cardholder name iframe tag, and thus cannot send the keys to enter a cardholder name. I'm wondering if there is a way to specifically search for the second (or an arbitrary number other than the first element) iframe tag with webdriver.</p>
  
  <p>Here is the code I used:</p>
  
  <pre><code>driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
  cc = driver.find_element_by_id("number")
  cc.send_keys(credit_card_number)
  </code></pre>
  
  <p>This correctly found the first iframe tag which contains the field to enter a card number, and sent the appropriate keys</p>
  
  <pre><code>driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
  driver.find_element_by_id("name").send_keys(cc_name)
  </code></pre>
  
  <p>This resulted in the following error: Message: no such element: Unable to locate element:{"method":"tag name","selector":"iframe"}</p>
  
  <p><a href="https://i.stack.imgur.com/gCFhf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gCFhf.png" alt="enter image description here"></a></p>