I have been working on this problem for a good 6 hours and I cannot for the life of me figure out why the form is not sending properly
br = mechanize.Browser()
br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36')]
#Makes it appear to be chrome
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.open("website")
linkfollow = br.follow_link()
br.select_form("aspnetForm")
br.form.set_all_readonly(False)
#Select form and set all readonly to False
control = br.form.find_control(name="namehere")
control.value = str(zipcode)
#Finds the control that toggles the zip codes
#this will iterate through a list eventually
print br.geturl()
response = br.submit(name="button_i_want_to_click_on")
print br.geturl()
#IT ALL WORKS UP TO HERE< FORM SUBMITS PROPERLY AND LOADS NEXT HTTP
br.select_form("aspnetForm")
br.form.set_all_readonly(False)
br.form["Radio group that i selected (I know this is correct)"] = ['correctValue']
br.form["Other Radio Group Thats selected"] = ['correctValue']
new_response = br.submit(name="Next Submit Button I want to click on")
print new_response.geturl()
I had to change the values and such because this is work related, but I fill in the radio buttons, and when I check if the elements have been selected it works fine. But when I submit the form it does not bring me to the next page in the sequence like it does when I do the exact same thing in the google chrome browser.
Are there things in JavaScript at work behind the scenes not allowing me to submit this form? Is there a better tool I should be using for web navigation such as this.
Can somebody help? This is driving me insane.