Reputation: 1526
I am trying to fill in all the forms in the website: https://breast.predict.nhs.uk/tool
import mechanize
br = mechanize.Browser()
br.set_handle_robots(False) #ignore robots.txt
br.open("https://breast.predict.nhs.uk/tool")
print(br.forms())
the output is an empty list and br.select_form(nr=0) gives this error:
File " line 18, in <module>
br.select_form(nr=0)
line 668, in select_form
raise FormNotFoundError("no form matching " + description)
mechanize._mechanize.FormNotFoundError: no form matching nr 0
I know there are forms in this website, so what am I missing?
Thank you for your help
Upvotes: 0
Views: 133
Reputation: 66
As far as I can see, mechanize does not support JavaScript rendering, which is happening on this site via React.js: There actually are no <form>
in the initial HTML. They are generated later through JS.
Upvotes: 1