My program takes an user input and searches it through a particular webpage . Further i want it to go and click on a particular link and then download the file present there .
Example :
- The webpage : http://www.rcsb.org/pdb/home/home.do
- The search Word :"1AW0"
- after you search the word on the website it takes you to : http://www.rcsb.org/pdb/explore/explore.do?structureId=1AW0
I want the program to go on the right hand side of the webpage and download the pdb file from the DOWNLOAD FILES option
I have managed to write a program using the mechanize module to automatically search the word however unable to find a way i can click on a link
my code :
import urllib2
import re
import mechanize
br = mechanize.Browser()
br.open("http://www.rcsb.org/pdb/home/home.do")
## name of the form that holds the search text area
br.select_form("headerQueryForm")
## "q" name of the teaxtarea in the html script
br["q"] = str("1AW0")
response = br.submit()
print response.read()
any help or any suggestions would help .
Btw i am intermediate programmer in Python and I am trying to learn the Jython module to try make this work .
Thanks in advance