Sunday, 15 September 2013

Follow a javascript link with mechanize and python

Follow a javascript link with mechanize and python

I'm doing some web scraping and the project is almost done, except for I
need to click a javascript link and I can't work out how to with Python
and mechanize.
On one of the pages, a list of javascript links appear and I want to
follow them in turn, scrape some data, and repeat. I know mechanize
doesn't work with javascript but does anyone know a workaround? Here's the
code I use to isolate the links:
for Auth in iterAuths:
Auth = str(Auth.contents[0]).strip()
br.find_link(text=Auth)
now if I do 'br.follow_link(text=Auth)', I get an error 'urllib2.URLError: '.
If I do 'print br.click_link(text=Auth'), I get: ''
I just need to get through the link. Can anyone help?

No comments:

Post a Comment