我尝试使用此脚本模仿链接点击:
#!/usr/bin/env python
import mechanize
targetPage = 'http://example.com/'
clickUrl="http://someurlinsideexample.com/"
br = mechanize.Browser(factory=mechanize.RobustFactory())
br.open(targetUrl)
br.follow_link(url=clickUrl)
但我收到此错误:
File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_mechanize.py", line 620, in find_link
raise LinkNotFoundError()
mechanize._mechanize.LinkNotFoundError
我的代码片段有什么问题以及如何解决?