点击使用蟒蛇beautifulsoup链接 [英] Clicking link using beautifulsoup in python
问题描述
在机械化我们点击通过使用follow_link或click_link链接。是否有一个类似的一种美丽的汤的事情点击网页上的链接?
In mechanize we click links either by using follow_link or click_link. Is there a similar kind of thing in beautiful soup to click a link on a web page?
推荐答案
BeautifulSoup
是一个HTML 解析器
进一步讨论实际上取决于具体的情况你是在和特定网页的复杂程度。
Further discussion really depends on the concrete situation you are in and the complexity of the particular web page.
如果你需要用网页交互:提交表单,点击按钮,滚动等 - 你需要使用一个工具,利用真正的浏览器,像的 硒
。
If you need to interact with a web-page: submit forms, click buttons, scroll etc - you need to use a tool that utilizes a real browser, like selenium
.
在某些情况下,例如,如果没有涉及提交表单, 机械化
也会为你工作。
In certain situations, for example, if there is no javascript involved in submitting a form, mechanize
would also work for you.
和,有时你可以通过简单地在与 的urllib2
或 请求
。
And, sometimes you can handle it by simply following the link with urllib2
or requests
.
这篇关于点击使用蟒蛇beautifulsoup链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!