short: How to execute/simulate javascript redirection
location.href="http://www.site2.com/";
with python Mechanize?
I've made a python script with mechanize module that looks for a link in a page and follows it.
The problem is on a particular site that when I do
br.follow_link("http://www.address1.com")
he redirects me to this simple page:
<script language="JavaScript">{
location.href="http://www.site2.com/";
self.focus();
}</script>
Now, if I do:
br = mechanize.Browser(factory=mechanize.RobustFactory())
... #other code
br.follow_link("http://www.address1.com")
for link in br.links():
br.follow_link(link)
print link
it doesn't prints anything, that means that there is no link in that page.
But if I manually parse the page and I execute:
br.open("http://www.site2.com")
Site2 doesn't recognizes that I'm coming from "www.address1.com" and the script does not work as I would like!
Sorry if it's just a newbie question and thank you in advance!
linkis a string object.