pythonmechanizecookielib

Having trouble signing into website using Python Mechanize.


I can't seem to select the "signinform" on this website using Python, the Mechanize module and the Cooklib. Any ideas what I'm doing wrong?

import mechanize
import cookielib
#Creating our browser.
browser = mechanize.Browser()

cj = cookielib.LWPCookieJar()
browser.set_cookiejar(cj)

browser.set_handle_equiv(True)
browser.set_handle_robots(False)
browser.set_handle_gzip(True)
browser.set_handle_redirect(True)
browser.set_handle_referer(True)

browser.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)

browser.addheaders = [('User-agent', 'IE 9')]

browser.open('http://www.saltybet.com/authenticate?signin=1')

#Attempting to select fields to input data. 

browser.select_form(name='signinform')
browser['email'] = '--myemail--'
browser['pword'] = '--mypassword--'
response = browser.submit()

Solution

  • I am not sure exactly where the problem is, howver I once had a similar problem that I solved using:

    response = browser.submit('enter')
    

    instead of

    response = browser.submit()