美丽的汤 vs selenium v​​s urllib

beautiful soup vs selenium vs urllib

我正在从事网络自动化项目。我需要能够拉取页面、评估数据并能够与页面交互(例如登录、输入值和 post 到站点。)作为登录的派生,我想我需要允许我在给定凭据的情况下保持登录状态的东西(例如存储凭据或 cookie。)

我已经使用 UrlLib 和 Requests 库来提取文件和页面本身。

我正在尝试为任务选择最好的 Python 库。

如有任何建议,我们将不胜感激。

谢谢!

@n1c9

If you can reliably recreate the HTTP requests being used to authenticate logins and speed is important, urllib/requests for making those HTTP requests and beautifulsoup for parsing the HTML responses would be best. Otherwise, Selenium is where you'll have the most luck. Let me know if you want more details.

看来 Selenium 是正确答案。