Q:

Selecting a frameset with index in Selenium with Python

Im currently in the phase of learning selenium with python.
Following is the code im trying to run:
browser=webdriver.Firefox()
browser.maximize_window()
browser.get('https://netbanking.hdfcbank.com')
#print browser.page_source

elems=browser.find_elements_by_tag_name('frameset')
browser.switch_to_frame(elems[1])
browser.find_element(By.CSS_SELECTOR,"input[class='input_password']").send_keys('123456789'+Keys.ENTER)

However Im unable to do so and ends up in an error.
Following is the error i see
/usr/bin/python2.7 /home/abhishek/PycharmProjects/Selenium/01_Selenium.py
Traceback (most recent call last):
  File "/home/abhishek/PycharmProjects/Selenium/01_Selenium.py", line 115, in <module>
    browser.switch_to_frame(elems[1])
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 537, in switch_to_frame
    self._switch_to.frame(frame_reference)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/switch_to.py", line 67, in frame
    self._driver.execute(Command.SWITCH_TO_FRAME, {'id': frame_reference})
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 201, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchFrameException: Message: Element is not a frame element: FRAMESET
Stacktrace:
    at FirefoxDriver.prototype.switchToFrame (file:///tmp/tmpbrHNVJ/extensions/fxdriver@googlecode.com/components/driver-component.js:10783)
    at DelayedCommand.prototype.executeInternal_/h (file:///tmp/tmpbrHNVJ/extensions/fxdriver@googlecode.com/components/command-processor.js:12614)
    at DelayedCommand.prototype.executeInternal_ (file:///tmp/tmpbrHNVJ/extensions/fxdriver@googlecode.com/components/command-processor.js:12619)
    at DelayedCommand.prototype.execute/< (file:///tmp/tmpbrHNVJ/extensions/fxdriver@googlecode.com/components/command-processor.js:12561)

Following is the pagesource:
/usr/bin/python2.7 /home/abhishek/PycharmProjects/Selenium/01_Selenium.py
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>Welcome to HDFC Bank NetBanking</title>
<script language="javascript">
    var daemon          = 'NETBANKING';
    var p_remoteaddress = '';
    var RsaAuthReq      = '';

    var l_path = window.location.pathname;

    if(l_path == undefined || l_path == '' || l_path.indexOf("/netbanking") &lt; 0){
        window.location.href = window.location.protocol + "//" + window.location.host +"/netbanking";
    }

</script>
</head>
    <frameset cols="*" rows="*" framespacing="0" frameborder="O" border="false">
        <frameset cols="*" rows="*,30" framespacing="0" frameborder="O" border="false">
            <frame scrolling="yes" noresize="true" src="RSLogin.html?v=2" name="login_page" marginheight="0" marginwidth="0" />
            <frame scrolling="no" noresize="true" src="footer.html" name="footer" marginheight="0" marginwidth="0" />
        </frameset>
    </frameset>

</html>

Following are my doubts:

What is the python alternative to Java's
browser.swichTo().Frame(int arg0) ?
Is the way of storing the webelements in a variable and using indexes to retrieve the required value a correct approach?

Kindly advice,
Thanks!

A:

What is the python alternative to Java's browser.swichTo().Frame(int arg0) ?

This is quite similar in Python:
number = 0  # first frame
browser.switch_to.frame(number)

Is the way of storing the webelements in a variable and using indexes to retrieve the required value a correct approach?

Yes, it could've worked in case the elements inside elems would be the frame elements.
In this case, you can do the following: 
browser.switch_to.frame(0)

or:
browser.switch_to.frame("login_page")

