title: filling up a login form using mechanize , python
body: <p>I was trying to login to a site <a href="https://everest.ioe.edu.np/lanusers/dialup.php" rel="nofollow">https://everest.ioe.edu.np/lanusers/dialup.php</a>  and then click on a 'change password' link , change the password and logout using mechanize with following piece of code :</p>
  
  <pre><code>import mechanize        
  
  def tryinglogin():
      browser = mechanize.Browser(factory=mechanize.RobustFactory())
      browser.set_handle_robots(False)
      r = browser.open("https://everest.ioe.edu.np/lanusers/dialup.php") #surfing web page
      browser.select_form(nr=0)               # Find first form of web page
      browser.form["name"] = "067bce001"
      browser.form["password1"] = "abc"    
      pass="password1"
      browser.submit()                    # submit
  
      html = browser.response().readlines()       # Read the response, html 
      for i in range(0,len(html)):
      if '&lt;u&gt;Your current LAN account status&lt;/b&gt;' in html[i]:  # filter    out one line 
          print(html[i])
  
  
      browser.find_link(text='Change password')
      req = browser.click_link(text='Change password')
      browser.open(req)
  #print browser.response().read()     #print html of logged in page
  
    r = browser.open(req)                #  surfing web page ,no problem upto here in code
    browser.select_form(nr=0)             
    browser.form["password"] = "abc"
    browser.form["password1"] = "bcdef"  # change password field  
    browser.form["password2"] = "bcdef"   #verify password field
    browser.submit()      
  
  if __name__ == "__main__":
      tryinglogin()
  </code></pre>
  
  <p>the code succesfully logs in , clicks change password link , and goes to change password page but then shows 
      "ParseError: nested FORMs Error"</p>
  
  <p>please gurus help me figure out why my bot is not working.</p>