MechanicalSoup (python 3x) 可以处理网站中的 javascript 吗?

Can MechanicalSoup (python 3x) deal with javascript in a website?

我可以成功登录并浏览网站,但是当我检查注销按钮时,它就像 javascript:__doPostBack('ctl00$lnkBtnLogout','') 一样,因为 link、follow_link() 对此不起作用(说:没有适配器)???有人可以帮助我吗?

来自https://github.com/MechanicalSoup/MechanicalSoup

A Python library for automating interaction with websites. MechanicalSoup automatically stores and sends cookies, follows redirects, and can follow links and submit forms. It doesn't do JavaScript.

这给了你两个选择。

自己做 JavaScript

阅读JavaScript。对其进行逆向工程。在 Python 中重新实现它。找出页面中的哪些数据是动态的并且是算法所需要的。使用 MechanicalSoup 提取它并将其插入到您的重新实现中。

不要使用 MechanicalSoup

改用支持 JavaScript 的东西(例如 Selenium 或 PhantomJS)。