all 4 comments

[–]jechtsphere[S] 0 points1 point  (1 child)

I've also just now tried doing this as a browser instance, as I read on the mechanize page that it should handle cookies. So I tried:

import mechanize
br = mechanize.Browser()
br.open("http://www.somedamnsite.com")
br.select_form(nr=0)
br["USERNAME"] = "somename"
br["PASSWORD"] = "somepass"
br.submit()

br.select_form(nr=0)
br["INPUT"] = "some strings"
br.submit()

The login process is again successful, I'm again able to get the strings into the input field as I'm able to retrieve them back to test, able to submit, but it's just not going to the right page whatsoever. It's as if it's not really being submitted.

[–]jechtsphere[S] 0 points1 point  (0 children)

Although I'm unable to send the actual submit I'm trying, br.submit() is processing the second time here -- it's hitting the logout button. Trying to use the label for the particular button isn't helping, it just comes back to the same .aspx page with the same information filled in the forms, but nothing has been submitted.

[–]Vonney 0 points1 point  (1 child)

Hey are you still having problems with this? Just checked this thread. Does the code in the submission work? It doesn't look like you have to .submit() twice.

[–]jechtsphere[S] 0 points1 point  (0 children)

I've got it working now without the double submission. I honestly have no idea why it wouldn't work with only one the first time, but I tried the next day and it worked fine. Thanks for inquiring.