DescentBB
http://www.descentbb.net/

[python][html]Can't get error. (Shortened question)
http://www.descentbb.net/viewtopic.php?f=7&t=21397
Page 1 of 1

Author:  Isaac [ Mon Jul 07, 2014 10:24 am ]
Post subject:  [python][html]Can't get error. (Shortened question)

Can any of you get a login error using this code? The program produces test.html, which should have a login error.

Code:
#!/usr/bin/env python
import mechanize
def twc():
   theurl = 'https://services.twc.state.tx.us/UITAXSERV/security/logon.do'
        br = mechanize.Browser()
   br.set_handle_refresh(False)
   br.set_handle_robots(False)
   br.open(theurl)
   print br.title()
   print br.geturl()
   def pageview(p):
      f=open("test.html","w")
      f.write(p)
      f.close()      
   br.select_form("logonForm")   
   br.form["username"] = "dkfdf"#un
   #br.form["password"] = ""#pw
   print "entered user info"
   br.submit()
   html= br.response().read()
   pageview(html)
   print br.title()
   print br.geturl()
twc()   



The error, in .errorsHeader, should appear like this:

Please correct the following errors:
Password: Enter 6 to 32 characters.


The server should print this around line 283 in the html.

Author:  Jeff250 [ Mon Jul 07, 2014 1:01 pm ]
Post subject:  Re: [python][html]Can't get error. (Shortened question)

Mechanize isn't picking up the submit button, possibly because the HTML is bad.

Add
Code:
br.form.new_control('submit', 'method:logon', {'value': 'Logon'})

before you call submit().

Author:  Isaac [ Mon Jul 07, 2014 2:47 pm ]
Post subject:  Re: [python][html]Can't get error. (Shortened question)

>> "Thank You!"*1000000000000000000

You are a real hero!

Page 1 of 1 All times are UTC-06:00
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/