I am trying to submit the textarea on https://keywordsheeter.com/ (name="findersearchQueryInput") then I want to be able to print the results of the submitted textarea to my console.
I tried form.set_value, form.find_control, and form["something"] = "something".
I realized this isn't working because the initial select_form() isn't finding the name (findersearchQueryInput) which is the name of the textarea on keywordsheeter.com
I was expecting to be able to find the form and go from there.
This is the code I have so far:
import mechanize
br = mechanize.Browser()
br.set_handle_robots(False)
br.addheaders = [('User-agent',
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
br.open("https://keywordsheeter.com/")
print(br.title())
print(br.forms())
br.select_form("findersearchQueryInput") # < not working...
br["keto diet "] = ["findersearchQueryInput"]
br.submit()
print(br.form)
Thanks so much in advance!
You should use selenium because
Mechanizedoes not supportJavaScriptfirst install it
pip install seleniumthen follow the instruction get the appropriate webDriver https://sites.google.com/a/chromium.org/chromedriver/downloadsThen you can modify your code like that: