MechanicalSoup(python3x)可以处理网站中的javascript吗?

2024-10-01 09:17:50 发布

您现在位置:Python中文网/ 问答频道 /正文

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


Tags: 网站链接linkjavascript适配器按钮followctl00
1条回答
网友
1楼 · 发布于 2024-10-01 09:17:50

来自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提取它并将其插入到重新实现中。在

不要使用机械组

使用支持JavaScript的东西(比如Selenium或PhantomJS)。在

相关问题 更多 >