2

I am trying to write a program to access this site. When both the password and ID are correct, the page redirects to another URL. When the user ID is wrong, it will notify the user via a popup and and when the password is wrong, it will not say anything (Try Barcode:21290004296682 PW:0000).

The problem I'm facing is that I can't get mechanize to differentiate between "wrong barcode" and "wrong password". In order words, I can't get it to recognize the popup dialog that displays after entering the wrong barcode.

Can anybody please help? And before people start thinking I'm doing this for malicious purposes, this is actually for my university's Information Security project.

Community
  • 1
  • 1
Display Name
  • 947
  • 2
  • 10
  • 18
  • Good question! My guess: 1. see you can list all mechanize browser/window instances. 2. see if you can get the `title` of the page, and if so, cycle through the windows until you get a page with the right title (in your case, the title of the popup) – inspectorG4dget Oct 07 '12 at 10:48
  • Unfortunately, mechanize's browser seems to skip the popup all together so the title, URL, and HTML are identical for both cases – Display Name Oct 07 '12 at 21:33
  • To be honest, I would recommend not using Python for this. Having spent months exclusively doing data mining, for sites that make extensive use of Javascript (the number of which is greatly increasing these days), I find that using Javascript-based environments like [PhantomJS](http://phantomjs.org/) are simply better for what you're trying to do. – jdotjdot Oct 14 '12 at 05:49

0 Answers0