Automatic login to website (newbie)

phishboh at gmail.com phishboh at gmail.com
Tue May 15 09:38:45 EDT 2007


I'm trying to use PAMIE to login to a website:

import cPAMIE

# python.org - just a test, works fine
ie = cPAMIE.PAMIE()
website = "http://www.python.org"
ie.navigate(website)
ie.textBoxSet('q', 'pamie')
ie.buttonClick('submit')

# expekt.com - this is what I want to do, but it fails
ie = cPAMIE.PAMIE()
website = "http://www.expekt.com/eng"
ie.navigate(website)
ie.textBoxSet('user', 'MyLogin')
ie.textBoxSet('pass', 'MyPassword')
ie.buttonClick('actn')

The first part of the script works fine, i.e., I can successfully open
IE, navigate to python.org, and do a search for "pamie".
However, when trying to login to the Expekt website, nothing is
entered in the text boxes, since they cannot be found. If I manually
navigate to the Expekt website, right click next to the login boxes,
and view source it looks like this:

<form name="loginForm" method="post" action="https://www.expekt.com:
443/userServlet?action=login" autocomplete="off" target="_top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="loginText">user:</td>
        <td width="110"><input type="text" name="user" class="login"></
td>
      </tr>
      <tr>
        <td class="loginText">password:</td>
        <td width="110"><input type="password" name="pass"
class="login"></td>
      </tr>
      <tr>
        <td colspan="2"><a class="loginForgot" href="javascript:wnd('/
user/password_retriever.jsp');">Forgot my password</a> </td>
      </tr>
      <tr>
        <td colspan="2" align="right"><input type="submit"
class="loginButton" id="log in" value="login"></td>
      </tr>
    </table>
    <input type="hidden" name="actn" value="login"></input>
    <input type="hidden" name="lc" value="eng"/></input>
</form>

To my (limited) understanding, it looks like I have the correct names
of the text boxes ("user" and "pass")?
Problem with frames?
Any ideas how to make it work?

Is there a better way of automatically logging in to websites (and
then navigating within the site)?

Many thanks in advance!




More information about the Python-list mailing list