I''m trying to download my EZ-Pass statements from www.e-zpassny.com using Mechanize. I''m having trouble logging in because the source of the captcha image is https://www.e-zpassny.com/vector/jcaptcha.do, which generates a new image every time it''s loaded. So when I attempt to look at it by opening it in a window, it''s already changed. How do I see the original image from my "login_page = agent.get ''https://www.e-zpassny.com/vector/account/home/accountLogin.do''"? Thanks. Sean
I never saw this post to the list (sorry if it''s a duplicate)... I''m trying to download my EZ-Pass statements from www.e-zpassny.com using Mechanize. I''m having trouble logging in because the source of the captcha image is https://www.e-zpassny.com/vector/jcaptcha.do, which generates a new image every time it''s loaded. So when I attempt to look at it by opening it in a window, it''s already changed. How do I see the original image from my "login_page = agent.get ''https://www.e-zpassny.com/vector/account/home/accountLogin.do''"? Thanks. Sean
Hey Sean, I have had a similar problem in the past. The issue is that the jcaptcha.do image is generating and validating captchas based on your session information, so you will need to download the image to disk, then view the image from your local copy. This way the session data used to get the captcha image is the same that is used to submit the form. Ben On Sun, Apr 24, 2011 at 7:42 AM, DeNigris Sean <sean at clipperadams.com>wrote:> I never saw this post to the list (sorry if it''s a duplicate)... > > I''m trying to download my EZ-Pass statements from www.e-zpassny.com using > Mechanize. I''m having trouble logging in because the source of the captcha > image is https://www.e-zpassny.com/vector/jcaptcha.do, which generates a > new image every time it''s loaded. So when I attempt to look at it by opening > it in a window, it''s already changed. > > How do I see the original image from my "login_page = agent.get '' > https://www.e-zpassny.com/vector/account/home/accountLogin.do''"? > > Thanks. > Sean > > > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users >-- Benjamin Manns benmanns at gmail.com (434) 321-8324 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20110424/9fb18a8c/attachment-0001.html>
On Apr 24, 2011, at 12:00 PM, Benjamin Manns wrote:> you will need to download the image to disk, then view the image from your local copy.Thanks. I tried your suggestion to download the image with the agent, but it doesn''t seem to work: require ''rubygems'' require ''mechanize'' agent = Mechanize.new login_page = agent.get ''https://www.e-zpassny.com/vector/account/home/accountLogin.do'' agent.get(''https://www.e-zpassny.com:443/vector/jcaptcha.do'').save_as(''/Users/sean/Library/Scripts/save_ezpass_statements/captcha.jpg'') #agent.get(''https://www.e-zpassny.com:443/vector/jcaptcha.do'').save_as(''/Users/sean/Library/Scripts/save_ezpass_statements/captcha2.jpg'') secret_code = gets.rstrip my_page = login_page.form_with(:name => ''accountLoginForm'') do |f| tagNumberRadioIndex = 1 f.radiobuttons_with(:name => ''loginType'')[tagNumberRadioIndex].check f.login = ''my username'' f.password = ''my password'' f.jcaptcha_response = secret_code end.submit The above gives me a new login page, after a failed login. I tried enabling the second download link, and it loads a new captcha image every time anyway.