点击python中的javascript链接? [英] Click on a javascript link within python?
问题描述
我正在使用python的机械化模块导航网站,并且无法点击下一页的javascript链接。我做了一些阅读,人们建议我需要python-spidermonkey和DOMforms。我设法安装它们我不确定实际点击链接的语法。
I am navigating a site using python's mechanize module and having trouble clicking on a javascript link for next page. I did a bit of reading and people suggested I need python-spidermonkey and DOMforms. I managed to get them installed by I am not sure of the syntax to actually click on the link.
我可以在页面上识别代码:
I can identify the code on the page as:
<a href="javascript:__doPostBack('ctl00$MainContent$gvSearchResults','Page$2')">2</a>
有谁知道如何点击它?或者是否有其他工具。
Does anyone know how to click on it? or if perhaps there's another tool.
谢谢
推荐答案
我主要是对于这些用例,请在jython下使用 HtmlUnit 。我还发表了一篇关于这个主题的简单文章: Web Scraping Ajax和Javascript站点。
I mainly use HtmlUnit under jython for these use cases. Also I published a simple article on the subject: Web Scraping Ajax and Javascript sites.
这篇关于点击python中的javascript链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!