How to navigate to and enter input in nested frame/form with mechanize

I want to enter some text (login, password) inside a page with frames. The structure is something like:

<html xmlns="">
      <body id="Body">
            <form id="frmM" onsubmit="javascript:return whatever();" action="Login.aspx" method="post">
                  <div id="alldata">
                        <div id="header">
                              <iframe id="Login_SSL" scrolling="no" frameborder="1" src="">
                                    <html xmlns="">
                                          <body onload="refreshParent()">
                                                <form id="form1" action="LoginFrame.aspx?redir=%2fUser%2fLogin.aspx" method="post">
                                                      <div id="loginRow" class="loginMenuRow" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'cmdLogin')">
                                                            <input id="cmdLogin" type="submit" tabindex="3" onclick=" ='_top';" value="Login" name="cmdLogin">
                                                             <input id="Password" class="textbox" type="password" tabindex="2" name="Password">
                                                             <span id="lblPassword" class="loginMenu">Password:</span>

If I try to find the form, I see that only the top level one is available.

FormNotFoundError: no form matching name 'form1'
>>[f.attrs['id'] for f in br.forms()]

How do I go about logging in to this site?


2 options:

  • Access the URL within the iframe directly and then do your form login

  • Login to the site from your browser and use an extension like Firebug to track the posted data. Then replicate this request to login automatically.

Need Your Help

Why Google Maps JavaScript API v3 returns different search result to search from


I am using google map javascript API v3 in my application.It returns different results from

Forgetting to Close a ServerSocket

java linux sockets tcp

If my program does not execute a ServerSocket.close() and/or Socket.close() before it terminates, the next time I start the program, it will always throw an IOException when attempting to start lis...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.